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.
- package/README.md +7 -3
- package/lib/app/core.d.ts +15 -22
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +17 -33
- package/lib/app/credential-factory.js +17 -33
- package/lib/app/credential-internal.d.ts +10 -9
- package/lib/app/credential-internal.js +15 -13
- package/lib/app/credential.d.ts +3 -9
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +6 -30
- package/lib/app/firebase-app.js +72 -216
- package/lib/app/firebase-namespace.d.ts +28 -34
- package/lib/app/firebase-namespace.js +119 -99
- package/lib/app/index.d.ts +6 -1
- package/lib/app/index.js +1 -1
- package/lib/app/lifecycle.d.ts +24 -3
- package/lib/app/lifecycle.js +119 -25
- package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
- package/lib/app-check/app-check-api-client-internal.js +197 -0
- package/lib/app-check/app-check-api.d.ts +95 -0
- package/lib/app-check/app-check-api.js +19 -0
- package/lib/app-check/app-check-namespace.d.ts +65 -0
- package/lib/app-check/app-check-namespace.js +18 -0
- package/lib/app-check/app-check.d.ts +49 -0
- package/lib/app-check/app-check.js +82 -0
- package/lib/app-check/index.d.ts +53 -0
- package/lib/app-check/index.js +63 -0
- package/lib/app-check/token-generator.d.ts +25 -0
- package/lib/app-check/token-generator.js +159 -0
- package/lib/app-check/token-verifier.d.ts +17 -0
- package/lib/app-check/token-verifier.js +151 -0
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +2 -2
- package/lib/auth/auth-api-request.d.ts +28 -32
- package/lib/auth/auth-api-request.js +167 -125
- package/lib/auth/auth-config.d.ts +123 -21
- package/lib/auth/auth-config.js +85 -34
- package/lib/auth/auth-namespace.d.ts +157 -4
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +5 -3
- package/lib/auth/auth.js +6 -4
- package/lib/auth/base-auth.d.ts +134 -116
- package/lib/auth/base-auth.js +213 -143
- package/lib/auth/identifier.d.ts +5 -5
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +10 -5
- package/lib/auth/index.js +9 -4
- package/lib/auth/tenant-manager.d.ts +19 -19
- package/lib/auth/tenant-manager.js +21 -25
- package/lib/auth/tenant.d.ts +14 -5
- package/lib/auth/tenant.js +19 -11
- package/lib/auth/token-generator.d.ts +7 -108
- package/lib/auth/token-generator.js +52 -145
- package/lib/auth/token-verifier.d.ts +3 -4
- package/lib/auth/token-verifier.js +96 -145
- package/lib/auth/user-import-builder.d.ts +11 -11
- package/lib/auth/user-import-builder.js +9 -9
- package/lib/auth/user-record.d.ts +23 -15
- package/lib/auth/user-record.js +30 -20
- package/lib/credential/index.d.ts +18 -35
- package/lib/credential/index.js +17 -33
- package/lib/database/database-namespace.d.ts +39 -10
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +16 -6
- package/lib/database/database.js +61 -6
- package/lib/database/index.d.ts +19 -18
- package/lib/database/index.js +21 -23
- package/lib/default-namespace.d.ts +7 -1
- package/lib/default-namespace.js +4 -4
- package/lib/esm/app/index.js +10 -0
- package/lib/esm/app-check/index.js +4 -0
- package/lib/esm/auth/index.js +14 -0
- package/lib/esm/database/index.js +6 -0
- package/lib/esm/firestore/index.js +24 -0
- package/lib/esm/installations/index.js +4 -0
- package/lib/esm/instance-id/index.js +4 -0
- package/lib/esm/machine-learning/index.js +5 -0
- package/lib/esm/messaging/index.js +4 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/project-management/index.js +8 -0
- package/lib/esm/remote-config/index.js +4 -0
- package/lib/esm/security-rules/index.js +6 -0
- package/lib/esm/storage/index.js +4 -0
- package/lib/firebase-namespace-api.d.ts +12 -6
- package/lib/firebase-namespace-api.js +5 -1
- package/lib/firestore/firestore-internal.d.ts +2 -2
- package/lib/firestore/firestore-internal.js +2 -2
- package/lib/firestore/firestore-namespace.d.ts +6 -1
- package/lib/firestore/firestore-namespace.js +2 -1
- package/lib/firestore/index.d.ts +36 -4
- package/lib/firestore/index.js +29 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +52 -0
- package/lib/installations/index.js +62 -0
- package/lib/installations/installations-namespace.d.ts +55 -0
- package/lib/installations/installations-namespace.js +18 -0
- package/lib/{instance-id/instance-id-request-internal.d.ts → installations/installations-request-handler.d.ts} +8 -8
- package/lib/{instance-id/instance-id-request-internal.js → installations/installations-request-handler.js} +23 -23
- package/lib/installations/installations.d.ts +38 -0
- package/lib/installations/installations.js +63 -0
- package/lib/instance-id/index.d.ts +20 -9
- package/lib/instance-id/index.js +20 -9
- package/lib/instance-id/instance-id-namespace.d.ts +9 -8
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +8 -6
- package/lib/instance-id/instance-id.js +20 -11
- package/lib/machine-learning/index.d.ts +29 -27
- package/lib/machine-learning/index.js +29 -27
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +4 -4
- package/lib/machine-learning/machine-learning-namespace.d.ts +33 -8
- 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 +19 -19
- package/lib/machine-learning/machine-learning.js +20 -20
- package/lib/messaging/batch-request-internal.d.ts +3 -3
- package/lib/messaging/batch-request-internal.js +9 -9
- package/lib/messaging/index.d.ts +11 -9
- package/lib/messaging/index.js +11 -9
- package/lib/messaging/messaging-api-request-internal.d.ts +8 -8
- package/lib/messaging/messaging-api-request-internal.js +8 -8
- package/lib/messaging/messaging-api.d.ts +79 -75
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +5 -5
- package/lib/messaging/messaging-errors-internal.js +7 -7
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +6 -31
- package/lib/messaging/messaging-namespace.d.ts +105 -8
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +70 -86
- package/lib/messaging/messaging.js +76 -89
- package/lib/project-management/android-app.d.ts +11 -12
- package/lib/project-management/android-app.js +13 -14
- 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 +11 -9
- package/lib/project-management/index.js +11 -9
- package/lib/project-management/ios-app.d.ts +6 -7
- package/lib/project-management/ios-app.js +6 -7
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -80
- package/lib/project-management/project-management-api-request-internal.js +14 -14
- package/lib/project-management/project-management-namespace.d.ts +31 -9
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +18 -21
- package/lib/project-management/project-management.js +19 -22
- package/lib/remote-config/index.d.ts +12 -10
- package/lib/remote-config/index.js +11 -9
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +2 -2
- package/lib/remote-config/remote-config-api.d.ts +12 -2
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config-namespace.d.ts +50 -9
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +19 -21
- package/lib/remote-config/remote-config.js +25 -25
- package/lib/security-rules/index.d.ts +12 -10
- package/lib/security-rules/index.js +12 -10
- 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 +43 -28
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +39 -42
- package/lib/security-rules/security-rules.js +38 -39
- package/lib/storage/index.d.ts +9 -7
- package/lib/storage/index.js +9 -7
- package/lib/storage/storage-namespace.d.ts +7 -6
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +3 -3
- package/lib/storage/storage.js +14 -4
- package/lib/utils/api-request.d.ts +24 -24
- package/lib/utils/api-request.js +25 -25
- package/lib/utils/crypto-signer.d.ts +128 -0
- package/lib/utils/crypto-signer.js +237 -0
- package/lib/utils/deep-copy.d.ts +6 -6
- package/lib/utils/deep-copy.js +6 -6
- package/lib/utils/error.d.ts +69 -36
- package/lib/utils/error.js +98 -43
- package/lib/utils/index.d.ts +30 -19
- package/lib/utils/index.js +47 -20
- package/lib/utils/jwt.d.ts +131 -0
- package/lib/utils/jwt.js +355 -0
- package/lib/utils/validator.d.ts +37 -37
- package/lib/utils/validator.js +37 -37
- package/package.json +126 -53
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2021 Google Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
var __extends = (this && this.__extends) || (function () {
|
|
20
|
+
var extendStatics = function (d, b) {
|
|
21
|
+
extendStatics = Object.setPrototypeOf ||
|
|
22
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
23
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
24
|
+
return extendStatics(d, b);
|
|
25
|
+
};
|
|
26
|
+
return function (d, b) {
|
|
27
|
+
extendStatics(d, b);
|
|
28
|
+
function __() { this.constructor = d; }
|
|
29
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
+
};
|
|
31
|
+
})();
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.FirebaseAppCheckError = exports.APP_CHECK_ERROR_CODE_MAPPING = exports.AppCheckApiClient = void 0;
|
|
34
|
+
var api_request_1 = require("../utils/api-request");
|
|
35
|
+
var error_1 = require("../utils/error");
|
|
36
|
+
var utils = require("../utils/index");
|
|
37
|
+
var validator = require("../utils/validator");
|
|
38
|
+
// App Check backend constants
|
|
39
|
+
var FIREBASE_APP_CHECK_V1_API_URL_FORMAT = 'https://firebaseappcheck.googleapis.com/v1beta/projects/{projectId}/apps/{appId}:exchangeCustomToken';
|
|
40
|
+
var FIREBASE_APP_CHECK_CONFIG_HEADERS = {
|
|
41
|
+
'X-Firebase-Client': "fire-admin-node/" + utils.getSdkVersion()
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Class that facilitates sending requests to the Firebase App Check backend API.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
var AppCheckApiClient = /** @class */ (function () {
|
|
49
|
+
function AppCheckApiClient(app) {
|
|
50
|
+
this.app = app;
|
|
51
|
+
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
52
|
+
throw new FirebaseAppCheckError('invalid-argument', 'First argument passed to admin.appCheck() must be a valid Firebase app instance.');
|
|
53
|
+
}
|
|
54
|
+
this.httpClient = new api_request_1.AuthorizedHttpClient(app);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Exchange a signed custom token to App Check token
|
|
58
|
+
*
|
|
59
|
+
* @param customToken - The custom token to be exchanged.
|
|
60
|
+
* @param appId - The mobile App ID.
|
|
61
|
+
* @returns A promise that fulfills with a `AppCheckToken`.
|
|
62
|
+
*/
|
|
63
|
+
AppCheckApiClient.prototype.exchangeToken = function (customToken, appId) {
|
|
64
|
+
var _this = this;
|
|
65
|
+
if (!validator.isNonEmptyString(appId)) {
|
|
66
|
+
throw new FirebaseAppCheckError('invalid-argument', '`appId` must be a non-empty string.');
|
|
67
|
+
}
|
|
68
|
+
if (!validator.isNonEmptyString(customToken)) {
|
|
69
|
+
throw new FirebaseAppCheckError('invalid-argument', '`customToken` must be a non-empty string.');
|
|
70
|
+
}
|
|
71
|
+
return this.getUrl(appId)
|
|
72
|
+
.then(function (url) {
|
|
73
|
+
var request = {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
url: url,
|
|
76
|
+
headers: FIREBASE_APP_CHECK_CONFIG_HEADERS,
|
|
77
|
+
data: { customToken: customToken }
|
|
78
|
+
};
|
|
79
|
+
return _this.httpClient.send(request);
|
|
80
|
+
})
|
|
81
|
+
.then(function (resp) {
|
|
82
|
+
return _this.toAppCheckToken(resp);
|
|
83
|
+
})
|
|
84
|
+
.catch(function (err) {
|
|
85
|
+
throw _this.toFirebaseError(err);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
AppCheckApiClient.prototype.getUrl = function (appId) {
|
|
89
|
+
return this.getProjectId()
|
|
90
|
+
.then(function (projectId) {
|
|
91
|
+
var urlParams = {
|
|
92
|
+
projectId: projectId,
|
|
93
|
+
appId: appId,
|
|
94
|
+
};
|
|
95
|
+
var baseUrl = utils.formatString(FIREBASE_APP_CHECK_V1_API_URL_FORMAT, urlParams);
|
|
96
|
+
return utils.formatString(baseUrl);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
AppCheckApiClient.prototype.getProjectId = function () {
|
|
100
|
+
var _this = this;
|
|
101
|
+
if (this.projectId) {
|
|
102
|
+
return Promise.resolve(this.projectId);
|
|
103
|
+
}
|
|
104
|
+
return utils.findProjectId(this.app)
|
|
105
|
+
.then(function (projectId) {
|
|
106
|
+
if (!validator.isNonEmptyString(projectId)) {
|
|
107
|
+
throw new FirebaseAppCheckError('unknown-error', 'Failed to determine project ID. Initialize the '
|
|
108
|
+
+ 'SDK with service account credentials or set project ID as an app option. '
|
|
109
|
+
+ 'Alternatively, set the GOOGLE_CLOUD_PROJECT environment variable.');
|
|
110
|
+
}
|
|
111
|
+
_this.projectId = projectId;
|
|
112
|
+
return projectId;
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
AppCheckApiClient.prototype.toFirebaseError = function (err) {
|
|
116
|
+
if (err instanceof error_1.PrefixedFirebaseError) {
|
|
117
|
+
return err;
|
|
118
|
+
}
|
|
119
|
+
var response = err.response;
|
|
120
|
+
if (!response.isJson()) {
|
|
121
|
+
return new FirebaseAppCheckError('unknown-error', "Unexpected response with status: " + response.status + " and body: " + response.text);
|
|
122
|
+
}
|
|
123
|
+
var error = response.data.error || {};
|
|
124
|
+
var code = 'unknown-error';
|
|
125
|
+
if (error.status && error.status in exports.APP_CHECK_ERROR_CODE_MAPPING) {
|
|
126
|
+
code = exports.APP_CHECK_ERROR_CODE_MAPPING[error.status];
|
|
127
|
+
}
|
|
128
|
+
var message = error.message || "Unknown server error: " + response.text;
|
|
129
|
+
return new FirebaseAppCheckError(code, message);
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Creates an AppCheckToken from the API response.
|
|
133
|
+
*
|
|
134
|
+
* @param resp - API response object.
|
|
135
|
+
* @returns An AppCheckToken instance.
|
|
136
|
+
*/
|
|
137
|
+
AppCheckApiClient.prototype.toAppCheckToken = function (resp) {
|
|
138
|
+
var token = resp.data.attestationToken;
|
|
139
|
+
// `ttl` is a string with the suffix "s" preceded by the number of seconds,
|
|
140
|
+
// with nanoseconds expressed as fractional seconds.
|
|
141
|
+
var ttlMillis = this.stringToMilliseconds(resp.data.ttl);
|
|
142
|
+
return {
|
|
143
|
+
token: token,
|
|
144
|
+
ttlMillis: ttlMillis
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Converts a duration string with the suffix `s` to milliseconds.
|
|
149
|
+
*
|
|
150
|
+
* @param duration - The duration as a string with the suffix "s" preceded by the
|
|
151
|
+
* number of seconds, with fractional seconds. For example, 3 seconds with 0 nanoseconds
|
|
152
|
+
* is expressed as "3s", while 3 seconds and 1 nanosecond is expressed as "3.000000001s",
|
|
153
|
+
* and 3 seconds and 1 microsecond is expressed as "3.000001s".
|
|
154
|
+
*
|
|
155
|
+
* @returns The duration in milliseconds.
|
|
156
|
+
*/
|
|
157
|
+
AppCheckApiClient.prototype.stringToMilliseconds = function (duration) {
|
|
158
|
+
if (!validator.isNonEmptyString(duration) || !duration.endsWith('s')) {
|
|
159
|
+
throw new FirebaseAppCheckError('invalid-argument', '`ttl` must be a valid duration string with the suffix `s`.');
|
|
160
|
+
}
|
|
161
|
+
var seconds = duration.slice(0, -1);
|
|
162
|
+
return Math.floor(Number(seconds) * 1000);
|
|
163
|
+
};
|
|
164
|
+
return AppCheckApiClient;
|
|
165
|
+
}());
|
|
166
|
+
exports.AppCheckApiClient = AppCheckApiClient;
|
|
167
|
+
exports.APP_CHECK_ERROR_CODE_MAPPING = {
|
|
168
|
+
ABORTED: 'aborted',
|
|
169
|
+
INVALID_ARGUMENT: 'invalid-argument',
|
|
170
|
+
INVALID_CREDENTIAL: 'invalid-credential',
|
|
171
|
+
INTERNAL: 'internal-error',
|
|
172
|
+
PERMISSION_DENIED: 'permission-denied',
|
|
173
|
+
UNAUTHENTICATED: 'unauthenticated',
|
|
174
|
+
NOT_FOUND: 'not-found',
|
|
175
|
+
UNKNOWN: 'unknown-error',
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Firebase App Check error code structure. This extends PrefixedFirebaseError.
|
|
179
|
+
*
|
|
180
|
+
* @param code - The error code.
|
|
181
|
+
* @param message - The error message.
|
|
182
|
+
* @constructor
|
|
183
|
+
*/
|
|
184
|
+
var FirebaseAppCheckError = /** @class */ (function (_super) {
|
|
185
|
+
__extends(FirebaseAppCheckError, _super);
|
|
186
|
+
function FirebaseAppCheckError(code, message) {
|
|
187
|
+
var _this = _super.call(this, 'app-check', code, message) || this;
|
|
188
|
+
/* tslint:disable:max-line-length */
|
|
189
|
+
// Set the prototype explicitly. See the following link for more details:
|
|
190
|
+
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
191
|
+
/* tslint:enable:max-line-length */
|
|
192
|
+
_this.__proto__ = FirebaseAppCheckError.prototype;
|
|
193
|
+
return _this;
|
|
194
|
+
}
|
|
195
|
+
return FirebaseAppCheckError;
|
|
196
|
+
}(error_1.PrefixedFirebaseError));
|
|
197
|
+
exports.FirebaseAppCheckError = FirebaseAppCheckError;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2021 Google Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Interface representing an App Check token.
|
|
20
|
+
*/
|
|
21
|
+
export interface AppCheckToken {
|
|
22
|
+
/**
|
|
23
|
+
* The Firebase App Check token.
|
|
24
|
+
*/
|
|
25
|
+
token: string;
|
|
26
|
+
/**
|
|
27
|
+
* The time-to-live duration of the token in milliseconds.
|
|
28
|
+
*/
|
|
29
|
+
ttlMillis: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Interface representing App Check token options.
|
|
33
|
+
*/
|
|
34
|
+
export interface AppCheckTokenOptions {
|
|
35
|
+
/**
|
|
36
|
+
* The length of time, in milliseconds, for which the App Check token will
|
|
37
|
+
* be valid. This value must be between 30 minutes and 7 days, inclusive.
|
|
38
|
+
*/
|
|
39
|
+
ttlMillis?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Interface representing a decoded Firebase App Check token, returned from the
|
|
43
|
+
* {@link AppCheck.verifyToken} method.
|
|
44
|
+
*/
|
|
45
|
+
export interface DecodedAppCheckToken {
|
|
46
|
+
/**
|
|
47
|
+
* The issuer identifier for the issuer of the response.
|
|
48
|
+
* This value is a URL with the format
|
|
49
|
+
* `https://firebaseappcheck.googleapis.com/<PROJECT_NUMBER>`, where `<PROJECT_NUMBER>` is the
|
|
50
|
+
* same project number specified in the {@link DecodedAppCheckToken.aud | aud} property.
|
|
51
|
+
*/
|
|
52
|
+
iss: string;
|
|
53
|
+
/**
|
|
54
|
+
* The Firebase App ID corresponding to the app the token belonged to.
|
|
55
|
+
* As a convenience, this value is copied over to the {@link DecodedAppCheckToken.app_id | app_id} property.
|
|
56
|
+
*/
|
|
57
|
+
sub: string;
|
|
58
|
+
/**
|
|
59
|
+
* The audience for which this token is intended.
|
|
60
|
+
* This value is a JSON array of two strings, the first is the project number of your
|
|
61
|
+
* Firebase project, and the second is the project ID of the same project.
|
|
62
|
+
*/
|
|
63
|
+
aud: string[];
|
|
64
|
+
/**
|
|
65
|
+
* The App Check token's expiration time, in seconds since the Unix epoch. That is, the
|
|
66
|
+
* time at which this App Check token expires and should no longer be considered valid.
|
|
67
|
+
*/
|
|
68
|
+
exp: number;
|
|
69
|
+
/**
|
|
70
|
+
* The App Check token's issued-at time, in seconds since the Unix epoch. That is, the
|
|
71
|
+
* time at which this App Check token was issued and should start to be considered
|
|
72
|
+
* valid.
|
|
73
|
+
*/
|
|
74
|
+
iat: number;
|
|
75
|
+
/**
|
|
76
|
+
* The App ID corresponding to the App the App Check token belonged to.
|
|
77
|
+
* This value is not actually one of the JWT token claims. It is added as a
|
|
78
|
+
* convenience, and is set as the value of the {@link DecodedAppCheckToken.sub | sub} property.
|
|
79
|
+
*/
|
|
80
|
+
app_id: string;
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Interface representing a verified App Check token response.
|
|
85
|
+
*/
|
|
86
|
+
export interface VerifyAppCheckTokenResponse {
|
|
87
|
+
/**
|
|
88
|
+
* The App ID corresponding to the App the App Check token belonged to.
|
|
89
|
+
*/
|
|
90
|
+
appId: string;
|
|
91
|
+
/**
|
|
92
|
+
* The decoded Firebase App Check token.
|
|
93
|
+
*/
|
|
94
|
+
token: DecodedAppCheckToken;
|
|
95
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2021 Google Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2021 Google Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { App } from '../app';
|
|
18
|
+
import { AppCheckToken as TAppCheckToken, AppCheckTokenOptions as TAppCheckTokenOptions, DecodedAppCheckToken as TDecodedAppCheckToken, VerifyAppCheckTokenResponse as TVerifyAppCheckTokenResponse } from './app-check-api';
|
|
19
|
+
import { AppCheck as TAppCheck } from './app-check';
|
|
20
|
+
/**
|
|
21
|
+
* Gets the {@link firebase-admin.app-check#AppCheck} service for the default app or a given app.
|
|
22
|
+
*
|
|
23
|
+
* `admin.appCheck()` can be called with no arguments to access the default
|
|
24
|
+
* app's `AppCheck` service or as `admin.appCheck(app)` to access the
|
|
25
|
+
* `AppCheck` service associated with a specific app.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```javascript
|
|
29
|
+
* // Get the `AppCheck` service for the default app
|
|
30
|
+
* var defaultAppCheck = admin.appCheck();
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```javascript
|
|
35
|
+
* // Get the `AppCheck` service for a given app
|
|
36
|
+
* var otherAppCheck = admin.appCheck(otherApp);
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param app - Optional app for which to return the `AppCheck` service.
|
|
40
|
+
* If not provided, the default `AppCheck` service is returned.
|
|
41
|
+
*
|
|
42
|
+
* @returns The default `AppCheck` service if no
|
|
43
|
+
* app is provided, or the `AppCheck` service associated with the provided
|
|
44
|
+
* app.
|
|
45
|
+
*/
|
|
46
|
+
export declare function appCheck(app?: App): appCheck.AppCheck;
|
|
47
|
+
export declare namespace appCheck {
|
|
48
|
+
/**
|
|
49
|
+
* Type alias to {@link firebase-admin.app-check#AppCheck}.
|
|
50
|
+
*/
|
|
51
|
+
type AppCheck = TAppCheck;
|
|
52
|
+
/**
|
|
53
|
+
* Type alias to {@link firebase-admin.app-check#AppCheckToken}.
|
|
54
|
+
*/
|
|
55
|
+
type AppCheckToken = TAppCheckToken;
|
|
56
|
+
/**
|
|
57
|
+
* Type alias to {@link firebase-admin.app-check#DecodedAppCheckToken}.
|
|
58
|
+
*/
|
|
59
|
+
type DecodedAppCheckToken = TDecodedAppCheckToken;
|
|
60
|
+
/**
|
|
61
|
+
* Type alias to {@link firebase-admin.app-check#VerifyAppCheckTokenResponse}.
|
|
62
|
+
*/
|
|
63
|
+
type VerifyAppCheckTokenResponse = TVerifyAppCheckTokenResponse;
|
|
64
|
+
type AppCheckTokenOptions = TAppCheckTokenOptions;
|
|
65
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright 2021 Google Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2021 Google Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { App } from '../app';
|
|
19
|
+
import { AppCheckToken, AppCheckTokenOptions, VerifyAppCheckTokenResponse } from './app-check-api';
|
|
20
|
+
/**
|
|
21
|
+
* The Firebase `AppCheck` service interface.
|
|
22
|
+
*/
|
|
23
|
+
export declare class AppCheck {
|
|
24
|
+
readonly app: App;
|
|
25
|
+
private readonly client;
|
|
26
|
+
private readonly tokenGenerator;
|
|
27
|
+
private readonly appCheckTokenVerifier;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new {@link AppCheckToken} that can be sent
|
|
30
|
+
* back to a client.
|
|
31
|
+
*
|
|
32
|
+
* @param appId - The app ID to use as the JWT app_id.
|
|
33
|
+
* @param options - Optional options object when creating a new App Check Token.
|
|
34
|
+
*
|
|
35
|
+
* @returns A promise that fulfills with a `AppCheckToken`.
|
|
36
|
+
*/
|
|
37
|
+
createToken(appId: string, options?: AppCheckTokenOptions): Promise<AppCheckToken>;
|
|
38
|
+
/**
|
|
39
|
+
* Verifies a Firebase App Check token (JWT). If the token is valid, the promise is
|
|
40
|
+
* fulfilled with the token's decoded claims; otherwise, the promise is
|
|
41
|
+
* rejected.
|
|
42
|
+
*
|
|
43
|
+
* @param appCheckToken - The App Check token to verify.
|
|
44
|
+
*
|
|
45
|
+
* @returns A promise fulfilled with the token's decoded claims
|
|
46
|
+
* if the App Check token is valid; otherwise, a rejected promise.
|
|
47
|
+
*/
|
|
48
|
+
verifyToken(appCheckToken: string): Promise<VerifyAppCheckTokenResponse>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2021 Google Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.AppCheck = void 0;
|
|
21
|
+
var app_check_api_client_internal_1 = require("./app-check-api-client-internal");
|
|
22
|
+
var token_generator_1 = require("./token-generator");
|
|
23
|
+
var token_verifier_1 = require("./token-verifier");
|
|
24
|
+
var crypto_signer_1 = require("../utils/crypto-signer");
|
|
25
|
+
/**
|
|
26
|
+
* The Firebase `AppCheck` service interface.
|
|
27
|
+
*/
|
|
28
|
+
var AppCheck = /** @class */ (function () {
|
|
29
|
+
/**
|
|
30
|
+
* @param app - The app for this AppCheck service.
|
|
31
|
+
* @constructor
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
function AppCheck(app) {
|
|
35
|
+
this.app = app;
|
|
36
|
+
this.client = new app_check_api_client_internal_1.AppCheckApiClient(app);
|
|
37
|
+
try {
|
|
38
|
+
this.tokenGenerator = new token_generator_1.AppCheckTokenGenerator(crypto_signer_1.cryptoSignerFromApp(app));
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
throw token_generator_1.appCheckErrorFromCryptoSignerError(err);
|
|
42
|
+
}
|
|
43
|
+
this.appCheckTokenVerifier = new token_verifier_1.AppCheckTokenVerifier(app);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new {@link AppCheckToken} that can be sent
|
|
47
|
+
* back to a client.
|
|
48
|
+
*
|
|
49
|
+
* @param appId - The app ID to use as the JWT app_id.
|
|
50
|
+
* @param options - Optional options object when creating a new App Check Token.
|
|
51
|
+
*
|
|
52
|
+
* @returns A promise that fulfills with a `AppCheckToken`.
|
|
53
|
+
*/
|
|
54
|
+
AppCheck.prototype.createToken = function (appId, options) {
|
|
55
|
+
var _this = this;
|
|
56
|
+
return this.tokenGenerator.createCustomToken(appId, options)
|
|
57
|
+
.then(function (customToken) {
|
|
58
|
+
return _this.client.exchangeToken(customToken, appId);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Verifies a Firebase App Check token (JWT). If the token is valid, the promise is
|
|
63
|
+
* fulfilled with the token's decoded claims; otherwise, the promise is
|
|
64
|
+
* rejected.
|
|
65
|
+
*
|
|
66
|
+
* @param appCheckToken - The App Check token to verify.
|
|
67
|
+
*
|
|
68
|
+
* @returns A promise fulfilled with the token's decoded claims
|
|
69
|
+
* if the App Check token is valid; otherwise, a rejected promise.
|
|
70
|
+
*/
|
|
71
|
+
AppCheck.prototype.verifyToken = function (appCheckToken) {
|
|
72
|
+
return this.appCheckTokenVerifier.verifyToken(appCheckToken)
|
|
73
|
+
.then(function (decodedToken) {
|
|
74
|
+
return {
|
|
75
|
+
appId: decodedToken.app_id,
|
|
76
|
+
token: decodedToken,
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
return AppCheck;
|
|
81
|
+
}());
|
|
82
|
+
exports.AppCheck = AppCheck;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2021 Google Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Firebase App Check.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
import { App } from '../app';
|
|
24
|
+
import { AppCheck } from './app-check';
|
|
25
|
+
export { AppCheckToken, AppCheckTokenOptions, DecodedAppCheckToken, VerifyAppCheckTokenResponse, } from './app-check-api';
|
|
26
|
+
export { AppCheck } from './app-check';
|
|
27
|
+
/**
|
|
28
|
+
* Gets the {@link AppCheck} service for the default app or a given app.
|
|
29
|
+
*
|
|
30
|
+
* `getAppCheck()` can be called with no arguments to access the default
|
|
31
|
+
* app's `AppCheck` service or as `getAppCheck(app)` to access the
|
|
32
|
+
* `AppCheck` service associated with a specific app.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```javascript
|
|
36
|
+
* // Get the `AppCheck` service for the default app
|
|
37
|
+
* const defaultAppCheck = getAppCheck();
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```javascript
|
|
42
|
+
* // Get the `AppCheck` service for a given app
|
|
43
|
+
* const otherAppCheck = getAppCheck(otherApp);
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @param app - Optional app for which to return the `AppCheck` service.
|
|
47
|
+
* If not provided, the default `AppCheck` service is returned.
|
|
48
|
+
*
|
|
49
|
+
* @returns The default `AppCheck` service if no
|
|
50
|
+
* app is provided, or the `AppCheck` service associated with the provided
|
|
51
|
+
* app.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getAppCheck(app?: App): AppCheck;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2021 Google Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.getAppCheck = void 0;
|
|
21
|
+
/**
|
|
22
|
+
* Firebase App Check.
|
|
23
|
+
*
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
var app_1 = require("../app");
|
|
27
|
+
var app_check_1 = require("./app-check");
|
|
28
|
+
var app_check_2 = require("./app-check");
|
|
29
|
+
Object.defineProperty(exports, "AppCheck", { enumerable: true, get: function () { return app_check_2.AppCheck; } });
|
|
30
|
+
/**
|
|
31
|
+
* Gets the {@link AppCheck} service for the default app or a given app.
|
|
32
|
+
*
|
|
33
|
+
* `getAppCheck()` can be called with no arguments to access the default
|
|
34
|
+
* app's `AppCheck` service or as `getAppCheck(app)` to access the
|
|
35
|
+
* `AppCheck` service associated with a specific app.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```javascript
|
|
39
|
+
* // Get the `AppCheck` service for the default app
|
|
40
|
+
* const defaultAppCheck = getAppCheck();
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```javascript
|
|
45
|
+
* // Get the `AppCheck` service for a given app
|
|
46
|
+
* const otherAppCheck = getAppCheck(otherApp);
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param app - Optional app for which to return the `AppCheck` service.
|
|
50
|
+
* If not provided, the default `AppCheck` service is returned.
|
|
51
|
+
*
|
|
52
|
+
* @returns The default `AppCheck` service if no
|
|
53
|
+
* app is provided, or the `AppCheck` service associated with the provided
|
|
54
|
+
* app.
|
|
55
|
+
*/
|
|
56
|
+
function getAppCheck(app) {
|
|
57
|
+
if (typeof app === 'undefined') {
|
|
58
|
+
app = app_1.getApp();
|
|
59
|
+
}
|
|
60
|
+
var firebaseApp = app;
|
|
61
|
+
return firebaseApp.getOrInitService('appCheck', function (app) { return new app_check_1.AppCheck(app); });
|
|
62
|
+
}
|
|
63
|
+
exports.getAppCheck = getAppCheck;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2021 Google Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new `FirebaseAppCheckError` by extracting the error code, message and other relevant
|
|
20
|
+
* details from a `CryptoSignerError`.
|
|
21
|
+
*
|
|
22
|
+
* @param err - The Error to convert into a `FirebaseAppCheckError` error
|
|
23
|
+
* @returns A Firebase App Check error that can be returned to the user.
|
|
24
|
+
*/
|
|
25
|
+
export declare function appCheckErrorFromCryptoSignerError(err: Error): Error;
|