firebase-admin 9.100.0-alpha.0 → 10.0.2

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.
Files changed (188) hide show
  1. package/README.md +7 -3
  2. package/lib/app/core.d.ts +15 -22
  3. package/lib/app/core.js +1 -1
  4. package/lib/app/credential-factory.d.ts +17 -33
  5. package/lib/app/credential-factory.js +17 -33
  6. package/lib/app/credential-internal.d.ts +10 -9
  7. package/lib/app/credential-internal.js +15 -13
  8. package/lib/app/credential.d.ts +3 -9
  9. package/lib/app/credential.js +1 -1
  10. package/lib/app/firebase-app.d.ts +6 -30
  11. package/lib/app/firebase-app.js +72 -216
  12. package/lib/app/firebase-namespace.d.ts +28 -34
  13. package/lib/app/firebase-namespace.js +119 -99
  14. package/lib/app/index.d.ts +6 -1
  15. package/lib/app/index.js +1 -1
  16. package/lib/app/lifecycle.d.ts +24 -3
  17. package/lib/app/lifecycle.js +119 -25
  18. package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
  19. package/lib/app-check/app-check-api-client-internal.js +197 -0
  20. package/lib/app-check/app-check-api.d.ts +95 -0
  21. package/lib/app-check/app-check-api.js +19 -0
  22. package/lib/app-check/app-check-namespace.d.ts +65 -0
  23. package/lib/app-check/app-check-namespace.js +18 -0
  24. package/lib/app-check/app-check.d.ts +49 -0
  25. package/lib/app-check/app-check.js +82 -0
  26. package/lib/app-check/index.d.ts +53 -0
  27. package/lib/app-check/index.js +63 -0
  28. package/lib/app-check/token-generator.d.ts +25 -0
  29. package/lib/app-check/token-generator.js +159 -0
  30. package/lib/app-check/token-verifier.d.ts +17 -0
  31. package/lib/app-check/token-verifier.js +151 -0
  32. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  33. package/lib/auth/action-code-settings-builder.js +2 -2
  34. package/lib/auth/auth-api-request.d.ts +28 -32
  35. package/lib/auth/auth-api-request.js +167 -125
  36. package/lib/auth/auth-config.d.ts +123 -21
  37. package/lib/auth/auth-config.js +85 -34
  38. package/lib/auth/auth-namespace.d.ts +157 -4
  39. package/lib/auth/auth-namespace.js +1 -1
  40. package/lib/auth/auth.d.ts +5 -3
  41. package/lib/auth/auth.js +6 -4
  42. package/lib/auth/base-auth.d.ts +134 -116
  43. package/lib/auth/base-auth.js +213 -143
  44. package/lib/auth/identifier.d.ts +5 -5
  45. package/lib/auth/identifier.js +1 -1
  46. package/lib/auth/index.d.ts +10 -5
  47. package/lib/auth/index.js +9 -4
  48. package/lib/auth/tenant-manager.d.ts +19 -19
  49. package/lib/auth/tenant-manager.js +21 -25
  50. package/lib/auth/tenant.d.ts +14 -5
  51. package/lib/auth/tenant.js +19 -11
  52. package/lib/auth/token-generator.d.ts +7 -108
  53. package/lib/auth/token-generator.js +52 -145
  54. package/lib/auth/token-verifier.d.ts +3 -4
  55. package/lib/auth/token-verifier.js +96 -145
  56. package/lib/auth/user-import-builder.d.ts +11 -11
  57. package/lib/auth/user-import-builder.js +9 -9
  58. package/lib/auth/user-record.d.ts +23 -15
  59. package/lib/auth/user-record.js +30 -20
  60. package/lib/credential/index.d.ts +18 -35
  61. package/lib/credential/index.js +17 -33
  62. package/lib/database/database-namespace.d.ts +39 -10
  63. package/lib/database/database-namespace.js +1 -1
  64. package/lib/database/database.d.ts +16 -6
  65. package/lib/database/database.js +61 -6
  66. package/lib/database/index.d.ts +19 -18
  67. package/lib/database/index.js +21 -23
  68. package/lib/default-namespace.d.ts +7 -1
  69. package/lib/default-namespace.js +4 -4
  70. package/lib/esm/app/index.js +10 -0
  71. package/lib/esm/app-check/index.js +4 -0
  72. package/lib/esm/auth/index.js +14 -0
  73. package/lib/esm/database/index.js +6 -0
  74. package/lib/esm/firestore/index.js +24 -0
  75. package/lib/esm/installations/index.js +4 -0
  76. package/lib/esm/instance-id/index.js +4 -0
  77. package/lib/esm/machine-learning/index.js +5 -0
  78. package/lib/esm/messaging/index.js +4 -0
  79. package/lib/esm/package.json +1 -0
  80. package/lib/esm/project-management/index.js +8 -0
  81. package/lib/esm/remote-config/index.js +4 -0
  82. package/lib/esm/security-rules/index.js +6 -0
  83. package/lib/esm/storage/index.js +4 -0
  84. package/lib/firebase-namespace-api.d.ts +12 -6
  85. package/lib/firebase-namespace-api.js +5 -1
  86. package/lib/firestore/firestore-internal.d.ts +2 -2
  87. package/lib/firestore/firestore-internal.js +2 -2
  88. package/lib/firestore/firestore-namespace.d.ts +6 -1
  89. package/lib/firestore/firestore-namespace.js +2 -1
  90. package/lib/firestore/index.d.ts +36 -4
  91. package/lib/firestore/index.js +29 -1
  92. package/lib/index.d.ts +1 -1
  93. package/lib/index.js +1 -1
  94. package/lib/installations/index.d.ts +52 -0
  95. package/lib/installations/index.js +62 -0
  96. package/lib/installations/installations-namespace.d.ts +55 -0
  97. package/lib/installations/installations-namespace.js +18 -0
  98. package/lib/{instance-id/instance-id-request-internal.d.ts → installations/installations-request-handler.d.ts} +8 -8
  99. package/lib/{instance-id/instance-id-request-internal.js → installations/installations-request-handler.js} +23 -23
  100. package/lib/installations/installations.d.ts +38 -0
  101. package/lib/installations/installations.js +63 -0
  102. package/lib/instance-id/index.d.ts +20 -9
  103. package/lib/instance-id/index.js +20 -9
  104. package/lib/instance-id/instance-id-namespace.d.ts +9 -8
  105. package/lib/instance-id/instance-id-namespace.js +1 -1
  106. package/lib/instance-id/instance-id.d.ts +8 -6
  107. package/lib/instance-id/instance-id.js +20 -11
  108. package/lib/machine-learning/index.d.ts +29 -27
  109. package/lib/machine-learning/index.js +29 -27
  110. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  111. package/lib/machine-learning/machine-learning-api-client.js +4 -4
  112. package/lib/machine-learning/machine-learning-namespace.d.ts +33 -8
  113. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  114. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  115. package/lib/machine-learning/machine-learning-utils.js +1 -1
  116. package/lib/machine-learning/machine-learning.d.ts +19 -19
  117. package/lib/machine-learning/machine-learning.js +20 -20
  118. package/lib/messaging/batch-request-internal.d.ts +3 -3
  119. package/lib/messaging/batch-request-internal.js +9 -9
  120. package/lib/messaging/index.d.ts +11 -9
  121. package/lib/messaging/index.js +11 -9
  122. package/lib/messaging/messaging-api-request-internal.d.ts +8 -8
  123. package/lib/messaging/messaging-api-request-internal.js +8 -8
  124. package/lib/messaging/messaging-api.d.ts +79 -75
  125. package/lib/messaging/messaging-api.js +1 -1
  126. package/lib/messaging/messaging-errors-internal.d.ts +5 -5
  127. package/lib/messaging/messaging-errors-internal.js +7 -7
  128. package/lib/messaging/messaging-internal.d.ts +1 -1
  129. package/lib/messaging/messaging-internal.js +6 -31
  130. package/lib/messaging/messaging-namespace.d.ts +105 -8
  131. package/lib/messaging/messaging-namespace.js +1 -1
  132. package/lib/messaging/messaging.d.ts +70 -86
  133. package/lib/messaging/messaging.js +76 -89
  134. package/lib/project-management/android-app.d.ts +11 -12
  135. package/lib/project-management/android-app.js +13 -14
  136. package/lib/project-management/app-metadata.d.ts +1 -1
  137. package/lib/project-management/app-metadata.js +1 -1
  138. package/lib/project-management/index.d.ts +11 -9
  139. package/lib/project-management/index.js +11 -9
  140. package/lib/project-management/ios-app.d.ts +6 -7
  141. package/lib/project-management/ios-app.js +6 -7
  142. package/lib/project-management/project-management-api-request-internal.d.ts +1 -80
  143. package/lib/project-management/project-management-api-request-internal.js +14 -14
  144. package/lib/project-management/project-management-namespace.d.ts +31 -9
  145. package/lib/project-management/project-management-namespace.js +1 -1
  146. package/lib/project-management/project-management.d.ts +18 -21
  147. package/lib/project-management/project-management.js +19 -22
  148. package/lib/remote-config/index.d.ts +12 -10
  149. package/lib/remote-config/index.js +11 -9
  150. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  151. package/lib/remote-config/remote-config-api-client-internal.js +2 -2
  152. package/lib/remote-config/remote-config-api.d.ts +12 -2
  153. package/lib/remote-config/remote-config-api.js +1 -1
  154. package/lib/remote-config/remote-config-namespace.d.ts +50 -9
  155. package/lib/remote-config/remote-config-namespace.js +1 -1
  156. package/lib/remote-config/remote-config.d.ts +19 -21
  157. package/lib/remote-config/remote-config.js +25 -25
  158. package/lib/security-rules/index.d.ts +12 -10
  159. package/lib/security-rules/index.js +12 -10
  160. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  161. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  162. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  163. package/lib/security-rules/security-rules-internal.js +1 -1
  164. package/lib/security-rules/security-rules-namespace.d.ts +43 -28
  165. package/lib/security-rules/security-rules-namespace.js +1 -1
  166. package/lib/security-rules/security-rules.d.ts +39 -42
  167. package/lib/security-rules/security-rules.js +38 -39
  168. package/lib/storage/index.d.ts +9 -7
  169. package/lib/storage/index.js +9 -7
  170. package/lib/storage/storage-namespace.d.ts +7 -6
  171. package/lib/storage/storage-namespace.js +1 -1
  172. package/lib/storage/storage.d.ts +3 -3
  173. package/lib/storage/storage.js +14 -4
  174. package/lib/utils/api-request.d.ts +24 -24
  175. package/lib/utils/api-request.js +25 -25
  176. package/lib/utils/crypto-signer.d.ts +128 -0
  177. package/lib/utils/crypto-signer.js +237 -0
  178. package/lib/utils/deep-copy.d.ts +6 -6
  179. package/lib/utils/deep-copy.js +6 -6
  180. package/lib/utils/error.d.ts +69 -36
  181. package/lib/utils/error.js +98 -43
  182. package/lib/utils/index.d.ts +30 -19
  183. package/lib/utils/index.js +47 -20
  184. package/lib/utils/jwt.d.ts +131 -0
  185. package/lib/utils/jwt.js +355 -0
  186. package/lib/utils/validator.d.ts +37 -37
  187. package/lib/utils/validator.js +37 -37
  188. package/package.json +126 -53
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -17,7 +17,7 @@
17
17
  /**
18
18
  * Used for looking up an account by uid.
19
19
  *
20
- * See `auth.getUsers()`
20
+ * See {@link BaseAuth.getUsers}.
21
21
  */
22
22
  export interface UidIdentifier {
23
23
  uid: string;
@@ -25,7 +25,7 @@ export interface UidIdentifier {
25
25
  /**
26
26
  * Used for looking up an account by email.
27
27
  *
28
- * See `auth.getUsers()`
28
+ * See {@link BaseAuth.getUsers}.
29
29
  */
30
30
  export interface EmailIdentifier {
31
31
  email: string;
@@ -33,7 +33,7 @@ export interface EmailIdentifier {
33
33
  /**
34
34
  * Used for looking up an account by phone number.
35
35
  *
36
- * See `auth.getUsers()`
36
+ * See {@link BaseAuth.getUsers}.
37
37
  */
38
38
  export interface PhoneIdentifier {
39
39
  phoneNumber: string;
@@ -41,7 +41,7 @@ export interface PhoneIdentifier {
41
41
  /**
42
42
  * Used for looking up an account by federated provider.
43
43
  *
44
- * See `auth.getUsers()`
44
+ * See {@link BaseAuth.getUsers}.
45
45
  */
46
46
  export interface ProviderIdentifier {
47
47
  providerId: string;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -14,15 +14,20 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ /**
18
+ * Firebase Authentication.
19
+ *
20
+ * @packageDocumentation
21
+ */
17
22
  import { App } from '../app/index';
18
23
  import { Auth } from './auth';
19
24
  /**
20
- * Gets the {@link auth.Auth `Auth`} service for the default app or a
25
+ * Gets the {@link Auth} service for the default app or a
21
26
  * given app.
22
27
  *
23
28
  * `getAuth()` can be called with no arguments to access the default app's
24
- * {@link auth.Auth `Auth`} service or as `getAuth(app)` to access the
25
- * {@link auth.Auth `Auth`} service associated with a specific app.
29
+ * {@link Auth} service or as `getAuth(app)` to access the
30
+ * {@link Auth} service associated with a specific app.
26
31
  *
27
32
  * @example
28
33
  * ```javascript
@@ -40,7 +45,7 @@ import { Auth } from './auth';
40
45
  export declare function getAuth(app?: App): Auth;
41
46
  export { ActionCodeSettings } from './action-code-settings-builder';
42
47
  export { Auth, } from './auth';
43
- export { AuthFactorType, AuthProviderConfig, AuthProviderConfigFilter, CreateMultiFactorInfoRequest, CreatePhoneMultiFactorInfoRequest, CreateRequest, EmailSignInProviderConfig, ListProviderConfigResults, MultiFactorConfig, MultiFactorConfigState, MultiFactorCreateSettings, MultiFactorUpdateSettings, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, } from './auth-config';
48
+ export { AuthFactorType, AuthProviderConfig, AuthProviderConfigFilter, BaseAuthProviderConfig, BaseCreateMultiFactorInfoRequest, BaseUpdateMultiFactorInfoRequest, CreateMultiFactorInfoRequest, CreatePhoneMultiFactorInfoRequest, CreateRequest, EmailSignInProviderConfig, ListProviderConfigResults, MultiFactorConfig, MultiFactorConfigState, MultiFactorCreateSettings, MultiFactorUpdateSettings, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, } from './auth-config';
44
49
  export { BaseAuth, DeleteUsersResult, GetUsersResult, ListUsersResult, SessionCookieOptions, } from './base-auth';
45
50
  export { EmailIdentifier, PhoneIdentifier, ProviderIdentifier, UidIdentifier, UserIdentifier, } from './identifier';
46
51
  export { CreateTenantRequest, Tenant, UpdateTenantRequest, } from './tenant';
package/lib/auth/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -17,15 +17,20 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.getAuth = void 0;
20
+ /**
21
+ * Firebase Authentication.
22
+ *
23
+ * @packageDocumentation
24
+ */
20
25
  var index_1 = require("../app/index");
21
26
  var auth_1 = require("./auth");
22
27
  /**
23
- * Gets the {@link auth.Auth `Auth`} service for the default app or a
28
+ * Gets the {@link Auth} service for the default app or a
24
29
  * given app.
25
30
  *
26
31
  * `getAuth()` can be called with no arguments to access the default app's
27
- * {@link auth.Auth `Auth`} service or as `getAuth(app)` to access the
28
- * {@link auth.Auth `Auth`} service associated with a specific app.
32
+ * {@link Auth} service or as `getAuth(app)` to access the
33
+ * {@link Auth} service associated with a specific app.
29
34
  *
30
35
  * @example
31
36
  * ```javascript
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -19,13 +19,13 @@ import { Tenant, CreateTenantRequest, UpdateTenantRequest } from './tenant';
19
19
  import { DecodedIdToken } from './token-verifier';
20
20
  /**
21
21
  * Interface representing the object returned from a
22
- * {@link auth.TenantManager.listTenants `listTenants()`}
22
+ * {@link TenantManager.listTenants}
23
23
  * operation.
24
24
  * Contains the list of tenants for the current batch and the next page token if available.
25
25
  */
26
26
  export interface ListTenantsResult {
27
27
  /**
28
- * The list of {@link auth.Tenant `Tenant`} objects for the downloaded batch.
28
+ * The list of {@link Tenant} objects for the downloaded batch.
29
29
  */
30
30
  tenants: Tenant[];
31
31
  /**
@@ -39,7 +39,7 @@ export interface ListTenantsResult {
39
39
  *
40
40
  * Multi-tenancy support requires Google Cloud's Identity Platform
41
41
  * (GCIP). To learn more about GCIP, including pricing and features,
42
- * see the [GCIP documentation](https://cloud.google.com/identity-platform)
42
+ * see the {@link https://cloud.google.com/identity-platform | GCIP documentation}.
43
43
  *
44
44
  * Each tenant contains its own identity providers, settings and sets of users.
45
45
  * Using `TenantAwareAuth`, users for a specific tenant and corresponding OIDC/SAML
@@ -48,7 +48,7 @@ export interface ListTenantsResult {
48
48
  * tenant.
49
49
  *
50
50
  * `TenantAwareAuth` instances for a specific `tenantId` can be instantiated by calling
51
- * `auth.tenantManager().authForTenant(tenantId)`.
51
+ * {@link TenantManager.authForTenant}.
52
52
  */
53
53
  export declare class TenantAwareAuth extends BaseAuth {
54
54
  /**
@@ -88,17 +88,17 @@ export declare class TenantManager {
88
88
  /**
89
89
  * Returns a `TenantAwareAuth` instance bound to the given tenant ID.
90
90
  *
91
- * @param tenantId The tenant ID whose `TenantAwareAuth` instance is to be returned.
91
+ * @param tenantId - The tenant ID whose `TenantAwareAuth` instance is to be returned.
92
92
  *
93
- * @return The `TenantAwareAuth` instance corresponding to this tenant identifier.
93
+ * @returns The `TenantAwareAuth` instance corresponding to this tenant identifier.
94
94
  */
95
95
  authForTenant(tenantId: string): TenantAwareAuth;
96
96
  /**
97
97
  * Gets the tenant configuration for the tenant corresponding to a given `tenantId`.
98
98
  *
99
- * @param tenantId The tenant identifier corresponding to the tenant whose data to fetch.
99
+ * @param tenantId - The tenant identifier corresponding to the tenant whose data to fetch.
100
100
  *
101
- * @return A promise fulfilled with the tenant configuration to the provided `tenantId`.
101
+ * @returns A promise fulfilled with the tenant configuration to the provided `tenantId`.
102
102
  */
103
103
  getTenant(tenantId: string): Promise<Tenant>;
104
104
  /**
@@ -106,21 +106,21 @@ export declare class TenantManager {
106
106
  * starting from the offset as specified by `pageToken`. This is used to
107
107
  * retrieve all the tenants of a specified project in batches.
108
108
  *
109
- * @param maxResults The page size, 1000 if undefined. This is also
109
+ * @param maxResults - The page size, 1000 if undefined. This is also
110
110
  * the maximum allowed limit.
111
- * @param pageToken The next page token. If not specified, returns
111
+ * @param pageToken - The next page token. If not specified, returns
112
112
  * tenants starting without any offset.
113
113
  *
114
- * @return A promise that resolves with
114
+ * @returns A promise that resolves with
115
115
  * a batch of downloaded tenants and the next page token.
116
116
  */
117
117
  listTenants(maxResults?: number, pageToken?: string): Promise<ListTenantsResult>;
118
118
  /**
119
119
  * Deletes an existing tenant.
120
120
  *
121
- * @param tenantId The `tenantId` corresponding to the tenant to delete.
121
+ * @param tenantId - The `tenantId` corresponding to the tenant to delete.
122
122
  *
123
- * @return An empty promise fulfilled once the tenant has been deleted.
123
+ * @returns An empty promise fulfilled once the tenant has been deleted.
124
124
  */
125
125
  deleteTenant(tenantId: string): Promise<void>;
126
126
  /**
@@ -128,19 +128,19 @@ export declare class TenantManager {
128
128
  * When creating new tenants, tenants that use separate billing and quota will require their
129
129
  * own project and must be defined as `full_service`.
130
130
  *
131
- * @param tenantOptions The properties to set on the new tenant configuration to be created.
131
+ * @param tenantOptions - The properties to set on the new tenant configuration to be created.
132
132
  *
133
- * @return A promise fulfilled with the tenant configuration corresponding to the newly
133
+ * @returns A promise fulfilled with the tenant configuration corresponding to the newly
134
134
  * created tenant.
135
135
  */
136
136
  createTenant(tenantOptions: CreateTenantRequest): Promise<Tenant>;
137
137
  /**
138
138
  * Updates an existing tenant configuration.
139
139
  *
140
- * @param tenantId The `tenantId` corresponding to the tenant to delete.
141
- * @param tenantOptions The properties to update on the provided tenant.
140
+ * @param tenantId - The `tenantId` corresponding to the tenant to delete.
141
+ * @param tenantOptions - The properties to update on the provided tenant.
142
142
  *
143
- * @return A promise fulfilled with the update tenant data.
143
+ * @returns A promise fulfilled with the update tenant data.
144
144
  */
145
145
  updateTenant(tenantId: string, tenantOptions: UpdateTenantRequest): Promise<Tenant>;
146
146
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -35,7 +35,6 @@ var utils = require("../utils/index");
35
35
  var error_1 = require("../utils/error");
36
36
  var base_auth_1 = require("./base-auth");
37
37
  var tenant_1 = require("./tenant");
38
- var token_generator_1 = require("./token-generator");
39
38
  var auth_api_request_1 = require("./auth-api-request");
40
39
  /**
41
40
  * Tenant-aware `Auth` interface used for managing users, configuring SAML/OIDC providers,
@@ -43,7 +42,7 @@ var auth_api_request_1 = require("./auth-api-request");
43
42
  *
44
43
  * Multi-tenancy support requires Google Cloud's Identity Platform
45
44
  * (GCIP). To learn more about GCIP, including pricing and features,
46
- * see the [GCIP documentation](https://cloud.google.com/identity-platform)
45
+ * see the {@link https://cloud.google.com/identity-platform | GCIP documentation}.
47
46
  *
48
47
  * Each tenant contains its own identity providers, settings and sets of users.
49
48
  * Using `TenantAwareAuth`, users for a specific tenant and corresponding OIDC/SAML
@@ -52,23 +51,20 @@ var auth_api_request_1 = require("./auth-api-request");
52
51
  * tenant.
53
52
  *
54
53
  * `TenantAwareAuth` instances for a specific `tenantId` can be instantiated by calling
55
- * `auth.tenantManager().authForTenant(tenantId)`.
54
+ * {@link TenantManager.authForTenant}.
56
55
  */
57
56
  var TenantAwareAuth = /** @class */ (function (_super) {
58
57
  __extends(TenantAwareAuth, _super);
59
58
  /**
60
59
  * The TenantAwareAuth class constructor.
61
60
  *
62
- * @param app The app that created this tenant.
63
- * @param tenantId The corresponding tenant ID.
61
+ * @param app - The app that created this tenant.
62
+ * @param tenantId - The corresponding tenant ID.
64
63
  * @constructor
65
64
  * @internal
66
65
  */
67
66
  function TenantAwareAuth(app, tenantId) {
68
- var _this = this;
69
- var cryptoSigner = auth_api_request_1.useEmulator() ? new token_generator_1.EmulatedSigner() : token_generator_1.cryptoSignerFromApp(app);
70
- var tokenGenerator = new token_generator_1.FirebaseTokenGenerator(cryptoSigner, tenantId);
71
- _this = _super.call(this, app, new auth_api_request_1.TenantAwareAuthRequestHandler(app, tenantId), tokenGenerator) || this;
67
+ var _this = _super.call(this, app, new auth_api_request_1.TenantAwareAuthRequestHandler(app, tenantId), base_auth_1.createFirebaseTokenGenerator(app, tenantId)) || this;
72
68
  utils.addReadonlyGetter(_this, 'tenantId', tenantId);
73
69
  return _this;
74
70
  }
@@ -138,7 +134,7 @@ var TenantManager = /** @class */ (function () {
138
134
  /**
139
135
  * Initializes a TenantManager instance for a specified FirebaseApp.
140
136
  *
141
- * @param app The app for this TenantManager instance.
137
+ * @param app - The app for this TenantManager instance.
142
138
  *
143
139
  * @constructor
144
140
  * @internal
@@ -151,9 +147,9 @@ var TenantManager = /** @class */ (function () {
151
147
  /**
152
148
  * Returns a `TenantAwareAuth` instance bound to the given tenant ID.
153
149
  *
154
- * @param tenantId The tenant ID whose `TenantAwareAuth` instance is to be returned.
150
+ * @param tenantId - The tenant ID whose `TenantAwareAuth` instance is to be returned.
155
151
  *
156
- * @return The `TenantAwareAuth` instance corresponding to this tenant identifier.
152
+ * @returns The `TenantAwareAuth` instance corresponding to this tenant identifier.
157
153
  */
158
154
  TenantManager.prototype.authForTenant = function (tenantId) {
159
155
  if (!validator.isNonEmptyString(tenantId)) {
@@ -167,9 +163,9 @@ var TenantManager = /** @class */ (function () {
167
163
  /**
168
164
  * Gets the tenant configuration for the tenant corresponding to a given `tenantId`.
169
165
  *
170
- * @param tenantId The tenant identifier corresponding to the tenant whose data to fetch.
166
+ * @param tenantId - The tenant identifier corresponding to the tenant whose data to fetch.
171
167
  *
172
- * @return A promise fulfilled with the tenant configuration to the provided `tenantId`.
168
+ * @returns A promise fulfilled with the tenant configuration to the provided `tenantId`.
173
169
  */
174
170
  TenantManager.prototype.getTenant = function (tenantId) {
175
171
  return this.authRequestHandler.getTenant(tenantId)
@@ -182,12 +178,12 @@ var TenantManager = /** @class */ (function () {
182
178
  * starting from the offset as specified by `pageToken`. This is used to
183
179
  * retrieve all the tenants of a specified project in batches.
184
180
  *
185
- * @param maxResults The page size, 1000 if undefined. This is also
181
+ * @param maxResults - The page size, 1000 if undefined. This is also
186
182
  * the maximum allowed limit.
187
- * @param pageToken The next page token. If not specified, returns
183
+ * @param pageToken - The next page token. If not specified, returns
188
184
  * tenants starting without any offset.
189
185
  *
190
- * @return A promise that resolves with
186
+ * @returns A promise that resolves with
191
187
  * a batch of downloaded tenants and the next page token.
192
188
  */
193
189
  TenantManager.prototype.listTenants = function (maxResults, pageToken) {
@@ -214,9 +210,9 @@ var TenantManager = /** @class */ (function () {
214
210
  /**
215
211
  * Deletes an existing tenant.
216
212
  *
217
- * @param tenantId The `tenantId` corresponding to the tenant to delete.
213
+ * @param tenantId - The `tenantId` corresponding to the tenant to delete.
218
214
  *
219
- * @return An empty promise fulfilled once the tenant has been deleted.
215
+ * @returns An empty promise fulfilled once the tenant has been deleted.
220
216
  */
221
217
  TenantManager.prototype.deleteTenant = function (tenantId) {
222
218
  return this.authRequestHandler.deleteTenant(tenantId);
@@ -226,9 +222,9 @@ var TenantManager = /** @class */ (function () {
226
222
  * When creating new tenants, tenants that use separate billing and quota will require their
227
223
  * own project and must be defined as `full_service`.
228
224
  *
229
- * @param tenantOptions The properties to set on the new tenant configuration to be created.
225
+ * @param tenantOptions - The properties to set on the new tenant configuration to be created.
230
226
  *
231
- * @return A promise fulfilled with the tenant configuration corresponding to the newly
227
+ * @returns A promise fulfilled with the tenant configuration corresponding to the newly
232
228
  * created tenant.
233
229
  */
234
230
  TenantManager.prototype.createTenant = function (tenantOptions) {
@@ -240,10 +236,10 @@ var TenantManager = /** @class */ (function () {
240
236
  /**
241
237
  * Updates an existing tenant configuration.
242
238
  *
243
- * @param tenantId The `tenantId` corresponding to the tenant to delete.
244
- * @param tenantOptions The properties to update on the provided tenant.
239
+ * @param tenantId - The `tenantId` corresponding to the tenant to delete.
240
+ * @param tenantOptions - The properties to update on the provided tenant.
245
241
  *
246
- * @return A promise fulfilled with the update tenant data.
242
+ * @returns A promise fulfilled with the update tenant data.
247
243
  */
248
244
  TenantManager.prototype.updateTenant = function (tenantId, tenantOptions) {
249
245
  return this.authRequestHandler.updateTenant(tenantId, tenantOptions)
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -27,6 +27,10 @@ export interface UpdateTenantRequest {
27
27
  * The email sign in configuration.
28
28
  */
29
29
  emailSignInConfig?: EmailSignInProviderConfig;
30
+ /**
31
+ * Whether the anonymous provider is enabled.
32
+ */
33
+ anonymousSignInEnabled?: boolean;
30
34
  /**
31
35
  * The multi-factor auth configuration to update on the tenant.
32
36
  */
@@ -46,6 +50,7 @@ export declare type CreateTenantRequest = UpdateTenantRequest;
46
50
  /** The corresponding server side representation of a TenantOptions object. */
47
51
  export interface TenantOptionsServerRequest extends EmailSignInConfigServerRequest {
48
52
  displayName?: string;
53
+ enableAnonymousUser?: boolean;
49
54
  mfaConfig?: MultiFactorAuthServerConfig;
50
55
  testPhoneNumbers?: {
51
56
  [key: string]: string;
@@ -57,6 +62,7 @@ export interface TenantServerResponse {
57
62
  displayName?: string;
58
63
  allowPasswordSignup?: boolean;
59
64
  enableEmailLinkSignin?: boolean;
65
+ enableAnonymousUser?: boolean;
60
66
  mfaConfig?: MultiFactorAuthServerConfig;
61
67
  testPhoneNumbers?: {
62
68
  [key: string]: string;
@@ -67,7 +73,7 @@ export interface TenantServerResponse {
67
73
  *
68
74
  * Multi-tenancy support requires Google Cloud's Identity Platform
69
75
  * (GCIP). To learn more about GCIP, including pricing and features,
70
- * see the [GCIP documentation](https://cloud.google.com/identity-platform)
76
+ * see the {@link https://cloud.google.com/identity-platform | GCIP documentation}.
71
77
  *
72
78
  * Before multi-tenancy can be used on a Google Cloud Identity Platform project,
73
79
  * tenants must be allowed on that project via the Cloud Console UI.
@@ -91,6 +97,7 @@ export declare class Tenant {
91
97
  * The tenant display name.
92
98
  */
93
99
  readonly displayName?: string;
100
+ readonly anonymousSignInEnabled: boolean;
94
101
  /**
95
102
  * The map containing the test phone number / code pairs for the tenant.
96
103
  */
@@ -102,8 +109,8 @@ export declare class Tenant {
102
109
  /**
103
110
  * Validates a tenant options object. Throws an error on failure.
104
111
  *
105
- * @param {any} request The tenant options object to validate.
106
- * @param {boolean} createRequest Whether this is a create request.
112
+ * @param request - The tenant options object to validate.
113
+ * @param createRequest - Whether this is a create request.
107
114
  */
108
115
  private static validate;
109
116
  /**
@@ -115,7 +122,9 @@ export declare class Tenant {
115
122
  */
116
123
  get multiFactorConfig(): MultiFactorConfig | undefined;
117
124
  /**
118
- * @return A JSON-serializable representation of this object.
125
+ * Returns a JSON-serializable representation of this object.
126
+ *
127
+ * @returns A JSON-serializable representation of this object.
119
128
  */
120
129
  toJSON(): object;
121
130
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -26,7 +26,7 @@ var auth_config_1 = require("./auth-config");
26
26
  *
27
27
  * Multi-tenancy support requires Google Cloud's Identity Platform
28
28
  * (GCIP). To learn more about GCIP, including pricing and features,
29
- * see the [GCIP documentation](https://cloud.google.com/identity-platform)
29
+ * see the {@link https://cloud.google.com/identity-platform | GCIP documentation}.
30
30
  *
31
31
  * Before multi-tenancy can be used on a Google Cloud Identity Platform project,
32
32
  * tenants must be allowed on that project via the Cloud Console UI.
@@ -45,7 +45,7 @@ var Tenant = /** @class */ (function () {
45
45
  /**
46
46
  * The Tenant object constructor.
47
47
  *
48
- * @param response The server side response used to initialize the Tenant object.
48
+ * @param response - The server side response used to initialize the Tenant object.
49
49
  * @constructor
50
50
  * @internal
51
51
  */
@@ -65,6 +65,7 @@ var Tenant = /** @class */ (function () {
65
65
  allowPasswordSignup: false,
66
66
  });
67
67
  }
68
+ this.anonymousSignInEnabled = !!response.enableAnonymousUser;
68
69
  if (typeof response.mfaConfig !== 'undefined') {
69
70
  this.multiFactorConfig_ = new auth_config_1.MultiFactorAuthConfig(response.mfaConfig);
70
71
  }
@@ -75,9 +76,9 @@ var Tenant = /** @class */ (function () {
75
76
  /**
76
77
  * Builds the corresponding server request for a TenantOptions object.
77
78
  *
78
- * @param tenantOptions The properties to convert to a server request.
79
- * @param createRequest Whether this is a create request.
80
- * @return The equivalent server request.
79
+ * @param tenantOptions - The properties to convert to a server request.
80
+ * @param createRequest - Whether this is a create request.
81
+ * @returns The equivalent server request.
81
82
  *
82
83
  * @internal
83
84
  */
@@ -91,6 +92,9 @@ var Tenant = /** @class */ (function () {
91
92
  if (typeof tenantOptions.displayName !== 'undefined') {
92
93
  request.displayName = tenantOptions.displayName;
93
94
  }
95
+ if (typeof tenantOptions.anonymousSignInEnabled !== 'undefined') {
96
+ request.enableAnonymousUser = tenantOptions.anonymousSignInEnabled;
97
+ }
94
98
  if (typeof tenantOptions.multiFactorConfig !== 'undefined') {
95
99
  request.mfaConfig = auth_config_1.MultiFactorAuthConfig.buildServerRequest(tenantOptions.multiFactorConfig);
96
100
  }
@@ -103,8 +107,8 @@ var Tenant = /** @class */ (function () {
103
107
  /**
104
108
  * Returns the tenant ID corresponding to the resource name if available.
105
109
  *
106
- * @param {string} resourceName The server side resource name
107
- * @return {?string} The tenant ID corresponding to the resource, null otherwise.
110
+ * @param resourceName - The server side resource name
111
+ * @returns The tenant ID corresponding to the resource, null otherwise.
108
112
  *
109
113
  * @internal
110
114
  */
@@ -119,13 +123,14 @@ var Tenant = /** @class */ (function () {
119
123
  /**
120
124
  * Validates a tenant options object. Throws an error on failure.
121
125
  *
122
- * @param {any} request The tenant options object to validate.
123
- * @param {boolean} createRequest Whether this is a create request.
126
+ * @param request - The tenant options object to validate.
127
+ * @param createRequest - Whether this is a create request.
124
128
  */
125
129
  Tenant.validate = function (request, createRequest) {
126
130
  var validKeys = {
127
131
  displayName: true,
128
132
  emailSignInConfig: true,
133
+ anonymousSignInEnabled: true,
129
134
  multiFactorConfig: true,
130
135
  testPhoneNumbers: true,
131
136
  };
@@ -185,7 +190,9 @@ var Tenant = /** @class */ (function () {
185
190
  configurable: true
186
191
  });
187
192
  /**
188
- * @return A JSON-serializable representation of this object.
193
+ * Returns a JSON-serializable representation of this object.
194
+ *
195
+ * @returns A JSON-serializable representation of this object.
189
196
  */
190
197
  Tenant.prototype.toJSON = function () {
191
198
  var _a, _b;
@@ -194,6 +201,7 @@ var Tenant = /** @class */ (function () {
194
201
  displayName: this.displayName,
195
202
  emailSignInConfig: (_a = this.emailSignInConfig_) === null || _a === void 0 ? void 0 : _a.toJSON(),
196
203
  multiFactorConfig: (_b = this.multiFactorConfig_) === null || _b === void 0 ? void 0 : _b.toJSON(),
204
+ anonymousSignInEnabled: this.anonymousSignInEnabled,
197
205
  testPhoneNumbers: this.testPhoneNumbers,
198
206
  };
199
207
  if (typeof json.multiFactorConfig === 'undefined') {
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -16,77 +16,9 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  /// <reference types="node" />
19
- import { ServiceAccountCredential } from '../app/credential-internal';
20
- import { AuthorizedHttpClient } from '../utils/api-request';
19
+ import { CryptoSigner } from '../utils/crypto-signer';
21
20
  import { Algorithm } from 'jsonwebtoken';
22
- import { App } from '../app';
23
21
  export declare const BLACKLISTED_CLAIMS: string[];
24
- /**
25
- * CryptoSigner interface represents an object that can be used to sign JWTs.
26
- */
27
- export interface CryptoSigner {
28
- /**
29
- * The name of the signing algorithm.
30
- */
31
- readonly algorithm: Algorithm;
32
- /**
33
- * Cryptographically signs a buffer of data.
34
- *
35
- * @param {Buffer} buffer The data to be signed.
36
- * @return {Promise<Buffer>} A promise that resolves with the raw bytes of a signature.
37
- */
38
- sign(buffer: Buffer): Promise<Buffer>;
39
- /**
40
- * Returns the ID of the service account used to sign tokens.
41
- *
42
- * @return {Promise<string>} A promise that resolves with a service account ID.
43
- */
44
- getAccountId(): Promise<string>;
45
- }
46
- /**
47
- * A CryptoSigner implementation that uses an explicitly specified service account private key to
48
- * sign data. Performs all operations locally, and does not make any RPC calls.
49
- */
50
- export declare class ServiceAccountSigner implements CryptoSigner {
51
- private readonly credential;
52
- algorithm: Algorithm;
53
- /**
54
- * Creates a new CryptoSigner instance from the given service account credential.
55
- *
56
- * @param {ServiceAccountCredential} credential A service account credential.
57
- */
58
- constructor(credential: ServiceAccountCredential);
59
- /**
60
- * @inheritDoc
61
- */
62
- sign(buffer: Buffer): Promise<Buffer>;
63
- /**
64
- * @inheritDoc
65
- */
66
- getAccountId(): Promise<string>;
67
- }
68
- /**
69
- * A CryptoSigner implementation that uses the remote IAM service to sign data. If initialized without
70
- * a service account ID, attempts to discover a service account ID by consulting the local Metadata
71
- * service. This will succeed in managed environments like Google Cloud Functions and App Engine.
72
- *
73
- * @see https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/signBlob
74
- * @see https://cloud.google.com/compute/docs/storing-retrieving-metadata
75
- */
76
- export declare class IAMSigner implements CryptoSigner {
77
- algorithm: Algorithm;
78
- private readonly httpClient;
79
- private serviceAccountId?;
80
- constructor(httpClient: AuthorizedHttpClient, serviceAccountId?: string);
81
- /**
82
- * @inheritDoc
83
- */
84
- sign(buffer: Buffer): Promise<Buffer>;
85
- /**
86
- * @inheritDoc
87
- */
88
- getAccountId(): Promise<string>;
89
- }
90
22
  /**
91
23
  * A CryptoSigner implementation that is used when communicating with the Auth emulator.
92
24
  * It produces unsigned tokens.
@@ -103,43 +35,10 @@ export declare class EmulatedSigner implements CryptoSigner {
103
35
  getAccountId(): Promise<string>;
104
36
  }
105
37
  /**
106
- * Create a new CryptoSigner instance for the given app. If the app has been initialized with a service
107
- * account credential, creates a ServiceAccountSigner. Otherwise creates an IAMSigner.
38
+ * Creates a new FirebaseAuthError by extracting the error code, message and other relevant
39
+ * details from a CryptoSignerError.
108
40
  *
109
- * @param {FirebaseApp} app A FirebaseApp instance.
110
- * @return {CryptoSigner} A CryptoSigner instance.
111
- */
112
- export declare function cryptoSignerFromApp(app: App): CryptoSigner;
113
- /**
114
- * Class for generating different types of Firebase Auth tokens (JWTs).
41
+ * @param err - The Error to convert into a FirebaseAuthError error
42
+ * @returns A Firebase Auth error that can be returned to the user.
115
43
  */
116
- export declare class FirebaseTokenGenerator {
117
- readonly tenantId?: string | undefined;
118
- private readonly signer;
119
- /**
120
- * @param tenantId The tenant ID to use for the generated Firebase Auth
121
- * Custom token. If absent, then no tenant ID claim will be set in the
122
- * resulting JWT.
123
- */
124
- constructor(signer: CryptoSigner, tenantId?: string | undefined);
125
- /**
126
- * Creates a new Firebase Auth Custom token.
127
- *
128
- * @param uid The user ID to use for the generated Firebase Auth Custom token.
129
- * @param developerClaims Optional developer claims to include in the generated Firebase
130
- * Auth Custom token.
131
- * @return A Promise fulfilled with a Firebase Auth Custom token signed with a
132
- * service account key and containing the provided payload.
133
- */
134
- createCustomToken(uid: string, developerClaims?: {
135
- [key: string]: any;
136
- }): Promise<string>;
137
- private encodeSegment;
138
- /**
139
- * Returns whether or not the provided developer claims are valid.
140
- *
141
- * @param {object} [developerClaims] Optional developer claims to validate.
142
- * @return {boolean} True if the provided claims are valid; otherwise, false.
143
- */
144
- private isDeveloperClaimsValid_;
145
- }
44
+ export declare function handleCryptoSignerError(err: Error): Error;