summaryrefslogtreecommitdiff
path: root/frontend-old/node_modules/@firebase/app-check/dist/esm
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2025-11-16 19:08:29 +0800
committeraltaf-creator <dev@altafcreator.com>2025-11-16 19:08:29 +0800
commit434aa8343fdcbb4d5002f934979913c099489bee (patch)
tree55bab4ec5a6151be57797d34f61faf5ea744471b /frontend-old/node_modules/@firebase/app-check/dist/esm
parent893c388d4e99442a36005e5971a87730623f946e (diff)
sdk, del
Diffstat (limited to 'frontend-old/node_modules/@firebase/app-check/dist/esm')
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/index.esm.js1693
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/index.esm.js.map1
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/package.json1
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/api.d.ts105
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/api.test.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/client.d.ts30
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/client.test.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/constants.d.ts40
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/debug.d.ts22
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/debug.test.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/errors.d.ts66
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/factory.d.ts31
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/index.d.ts14
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/indexeddb.d.ts22
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/internal-api.d.ts44
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/internal-api.test.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/logger.d.ts18
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/proactive-refresh.d.ts35
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/proactive-refresh.test.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/providers.d.ts108
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/providers.test.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/public-types.d.ts85
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/recaptcha.d.ts43
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/recaptcha.test.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/state.d.ts54
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/storage.d.ts27
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/storage.test.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/types.d.ts66
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/src/util.d.ts21
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/test/setup.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/app-check/dist/esm/test/util.d.ts34
31 files changed, 0 insertions, 2713 deletions
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/index.esm.js b/frontend-old/node_modules/@firebase/app-check/dist/esm/index.esm.js
deleted file mode 100644
index d06b015..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/index.esm.js
+++ /dev/null
@@ -1,1693 +0,0 @@
-import { _getProvider, getApp, _registerComponent, registerVersion } from '@firebase/app';
-import { Component } from '@firebase/component';
-import { Deferred, ErrorFactory, isIndexedDBAvailable, getGlobal, base64, issuedAtTime, calculateBackoffMillis, getModularInstance } from '@firebase/util';
-import { Logger } from '@firebase/logger';
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const APP_CHECK_STATES = new Map();
-const DEFAULT_STATE = {
- activated: false,
- tokenObservers: []
-};
-const DEBUG_STATE = {
- initialized: false,
- enabled: false
-};
-/**
- * Gets a reference to the state object.
- */
-function getStateReference(app) {
- return APP_CHECK_STATES.get(app) || { ...DEFAULT_STATE };
-}
-/**
- * Set once on initialization. The map should hold the same reference to the
- * same object until this entry is deleted.
- */
-function setInitialState(app, state) {
- APP_CHECK_STATES.set(app, state);
- return APP_CHECK_STATES.get(app);
-}
-function getDebugState() {
- return DEBUG_STATE;
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const BASE_ENDPOINT = 'https://content-firebaseappcheck.googleapis.com/v1';
-const EXCHANGE_RECAPTCHA_TOKEN_METHOD = 'exchangeRecaptchaV3Token';
-const EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD = 'exchangeRecaptchaEnterpriseToken';
-const EXCHANGE_DEBUG_TOKEN_METHOD = 'exchangeDebugToken';
-const TOKEN_REFRESH_TIME = {
- /**
- * The offset time before token natural expiration to run the refresh.
- * This is currently 5 minutes.
- */
- OFFSET_DURATION: 5 * 60 * 1000,
- /**
- * This is the first retrial wait after an error. This is currently
- * 30 seconds.
- */
- RETRIAL_MIN_WAIT: 30 * 1000,
- /**
- * This is the maximum retrial wait, currently 16 minutes.
- */
- RETRIAL_MAX_WAIT: 16 * 60 * 1000
-};
-/**
- * One day in millis, for certain error code backoffs.
- */
-const ONE_DAY = 24 * 60 * 60 * 1000;
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Port from auth proactiverefresh.js
- *
- */
-// TODO: move it to @firebase/util?
-// TODO: allow to config whether refresh should happen in the background
-class Refresher {
- constructor(operation, retryPolicy, getWaitDuration, lowerBound, upperBound) {
- this.operation = operation;
- this.retryPolicy = retryPolicy;
- this.getWaitDuration = getWaitDuration;
- this.lowerBound = lowerBound;
- this.upperBound = upperBound;
- this.pending = null;
- this.nextErrorWaitInterval = lowerBound;
- if (lowerBound > upperBound) {
- throw new Error('Proactive refresh lower bound greater than upper bound!');
- }
- }
- start() {
- this.nextErrorWaitInterval = this.lowerBound;
- this.process(true).catch(() => {
- /* we don't care about the result */
- });
- }
- stop() {
- if (this.pending) {
- this.pending.reject('cancelled');
- this.pending = null;
- }
- }
- isRunning() {
- return !!this.pending;
- }
- async process(hasSucceeded) {
- this.stop();
- try {
- this.pending = new Deferred();
- this.pending.promise.catch(_e => {
- /* ignore */
- });
- await sleep(this.getNextRun(hasSucceeded));
- // Why do we resolve a promise, then immediate wait for it?
- // We do it to make the promise chain cancellable.
- // We can call stop() which rejects the promise before the following line execute, which makes
- // the code jump to the catch block.
- // TODO: unit test this
- this.pending.resolve();
- await this.pending.promise;
- this.pending = new Deferred();
- this.pending.promise.catch(_e => {
- /* ignore */
- });
- await this.operation();
- this.pending.resolve();
- await this.pending.promise;
- this.process(true).catch(() => {
- /* we don't care about the result */
- });
- }
- catch (error) {
- if (this.retryPolicy(error)) {
- this.process(false).catch(() => {
- /* we don't care about the result */
- });
- }
- else {
- this.stop();
- }
- }
- }
- getNextRun(hasSucceeded) {
- if (hasSucceeded) {
- // If last operation succeeded, reset next error wait interval and return
- // the default wait duration.
- this.nextErrorWaitInterval = this.lowerBound;
- // Return typical wait duration interval after a successful operation.
- return this.getWaitDuration();
- }
- else {
- // Get next error wait interval.
- const currentErrorWaitInterval = this.nextErrorWaitInterval;
- // Double interval for next consecutive error.
- this.nextErrorWaitInterval *= 2;
- // Make sure next wait interval does not exceed the maximum upper bound.
- if (this.nextErrorWaitInterval > this.upperBound) {
- this.nextErrorWaitInterval = this.upperBound;
- }
- return currentErrorWaitInterval;
- }
- }
-}
-function sleep(ms) {
- return new Promise(resolve => {
- setTimeout(resolve, ms);
- });
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const ERRORS = {
- ["already-initialized" /* AppCheckError.ALREADY_INITIALIZED */]: 'You have already called initializeAppCheck() for FirebaseApp {$appName} with ' +
- 'different options. To avoid this error, call initializeAppCheck() with the ' +
- 'same options as when it was originally called. This will return the ' +
- 'already initialized instance.',
- ["use-before-activation" /* AppCheckError.USE_BEFORE_ACTIVATION */]: 'App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. ' +
- 'Call initializeAppCheck() before instantiating other Firebase services.',
- ["fetch-network-error" /* AppCheckError.FETCH_NETWORK_ERROR */]: 'Fetch failed to connect to a network. Check Internet connection. ' +
- 'Original error: {$originalErrorMessage}.',
- ["fetch-parse-error" /* AppCheckError.FETCH_PARSE_ERROR */]: 'Fetch client could not parse response.' +
- ' Original error: {$originalErrorMessage}.',
- ["fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */]: 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.',
- ["storage-open" /* AppCheckError.STORAGE_OPEN */]: 'Error thrown when opening storage. Original error: {$originalErrorMessage}.',
- ["storage-get" /* AppCheckError.STORAGE_GET */]: 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',
- ["storage-set" /* AppCheckError.STORAGE_WRITE */]: 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',
- ["recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */]: 'ReCAPTCHA error.',
- ["initial-throttle" /* AppCheckError.INITIAL_THROTTLE */]: `{$httpStatus} error. Attempts allowed again after {$time}`,
- ["throttled" /* AppCheckError.THROTTLED */]: `Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}`
-};
-const ERROR_FACTORY = new ErrorFactory('appCheck', 'AppCheck', ERRORS);
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-function getRecaptcha(isEnterprise = false) {
- if (isEnterprise) {
- return self.grecaptcha?.enterprise;
- }
- return self.grecaptcha;
-}
-function ensureActivated(app) {
- if (!getStateReference(app).activated) {
- throw ERROR_FACTORY.create("use-before-activation" /* AppCheckError.USE_BEFORE_ACTIVATION */, {
- appName: app.name
- });
- }
-}
-function getDurationString(durationInMillis) {
- const totalSeconds = Math.round(durationInMillis / 1000);
- const days = Math.floor(totalSeconds / (3600 * 24));
- const hours = Math.floor((totalSeconds - days * 3600 * 24) / 3600);
- const minutes = Math.floor((totalSeconds - days * 3600 * 24 - hours * 3600) / 60);
- const seconds = totalSeconds - days * 3600 * 24 - hours * 3600 - minutes * 60;
- let result = '';
- if (days) {
- result += pad(days) + 'd:';
- }
- if (hours) {
- result += pad(hours) + 'h:';
- }
- result += pad(minutes) + 'm:' + pad(seconds) + 's';
- return result;
-}
-function pad(value) {
- if (value === 0) {
- return '00';
- }
- return value >= 10 ? value.toString() : '0' + value;
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-async function exchangeToken({ url, body }, heartbeatServiceProvider) {
- const headers = {
- 'Content-Type': 'application/json'
- };
- // If heartbeat service exists, add heartbeat header string to the header.
- const heartbeatService = heartbeatServiceProvider.getImmediate({
- optional: true
- });
- if (heartbeatService) {
- const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader();
- if (heartbeatsHeader) {
- headers['X-Firebase-Client'] = heartbeatsHeader;
- }
- }
- const options = {
- method: 'POST',
- body: JSON.stringify(body),
- headers
- };
- let response;
- try {
- response = await fetch(url, options);
- }
- catch (originalError) {
- throw ERROR_FACTORY.create("fetch-network-error" /* AppCheckError.FETCH_NETWORK_ERROR */, {
- originalErrorMessage: originalError?.message
- });
- }
- if (response.status !== 200) {
- throw ERROR_FACTORY.create("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */, {
- httpStatus: response.status
- });
- }
- let responseBody;
- try {
- // JSON parsing throws SyntaxError if the response body isn't a JSON string.
- responseBody = await response.json();
- }
- catch (originalError) {
- throw ERROR_FACTORY.create("fetch-parse-error" /* AppCheckError.FETCH_PARSE_ERROR */, {
- originalErrorMessage: originalError?.message
- });
- }
- // Protobuf duration format.
- // https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Duration
- const match = responseBody.ttl.match(/^([\d.]+)(s)$/);
- if (!match || !match[2] || isNaN(Number(match[1]))) {
- throw ERROR_FACTORY.create("fetch-parse-error" /* AppCheckError.FETCH_PARSE_ERROR */, {
- originalErrorMessage: `ttl field (timeToLive) is not in standard Protobuf Duration ` +
- `format: ${responseBody.ttl}`
- });
- }
- const timeToLiveAsNumber = Number(match[1]) * 1000;
- const now = Date.now();
- return {
- token: responseBody.token,
- expireTimeMillis: now + timeToLiveAsNumber,
- issuedAtTimeMillis: now
- };
-}
-function getExchangeRecaptchaV3TokenRequest(app, reCAPTCHAToken) {
- const { projectId, appId, apiKey } = app.options;
- return {
- url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_RECAPTCHA_TOKEN_METHOD}?key=${apiKey}`,
- body: {
- 'recaptcha_v3_token': reCAPTCHAToken
- }
- };
-}
-function getExchangeRecaptchaEnterpriseTokenRequest(app, reCAPTCHAToken) {
- const { projectId, appId, apiKey } = app.options;
- return {
- url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD}?key=${apiKey}`,
- body: {
- 'recaptcha_enterprise_token': reCAPTCHAToken
- }
- };
-}
-function getExchangeDebugTokenRequest(app, debugToken) {
- const { projectId, appId, apiKey } = app.options;
- return {
- url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_DEBUG_TOKEN_METHOD}?key=${apiKey}`,
- body: {
- // eslint-disable-next-line
- debug_token: debugToken
- }
- };
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const DB_NAME = 'firebase-app-check-database';
-const DB_VERSION = 1;
-const STORE_NAME = 'firebase-app-check-store';
-const DEBUG_TOKEN_KEY = 'debug-token';
-let dbPromise = null;
-function getDBPromise() {
- if (dbPromise) {
- return dbPromise;
- }
- dbPromise = new Promise((resolve, reject) => {
- try {
- const request = indexedDB.open(DB_NAME, DB_VERSION);
- request.onsuccess = event => {
- resolve(event.target.result);
- };
- request.onerror = event => {
- reject(ERROR_FACTORY.create("storage-open" /* AppCheckError.STORAGE_OPEN */, {
- originalErrorMessage: event.target.error?.message
- }));
- };
- request.onupgradeneeded = event => {
- const db = event.target.result;
- // We don't use 'break' in this switch statement, the fall-through
- // behavior is what we want, because if there are multiple versions between
- // the old version and the current version, we want ALL the migrations
- // that correspond to those versions to run, not only the last one.
- // eslint-disable-next-line default-case
- switch (event.oldVersion) {
- case 0:
- db.createObjectStore(STORE_NAME, {
- keyPath: 'compositeKey'
- });
- }
- };
- }
- catch (e) {
- reject(ERROR_FACTORY.create("storage-open" /* AppCheckError.STORAGE_OPEN */, {
- originalErrorMessage: e?.message
- }));
- }
- });
- return dbPromise;
-}
-function readTokenFromIndexedDB(app) {
- return read(computeKey(app));
-}
-function writeTokenToIndexedDB(app, token) {
- return write(computeKey(app), token);
-}
-function writeDebugTokenToIndexedDB(token) {
- return write(DEBUG_TOKEN_KEY, token);
-}
-function readDebugTokenFromIndexedDB() {
- return read(DEBUG_TOKEN_KEY);
-}
-async function write(key, value) {
- const db = await getDBPromise();
- const transaction = db.transaction(STORE_NAME, 'readwrite');
- const store = transaction.objectStore(STORE_NAME);
- const request = store.put({
- compositeKey: key,
- value
- });
- return new Promise((resolve, reject) => {
- request.onsuccess = _event => {
- resolve();
- };
- transaction.onerror = event => {
- reject(ERROR_FACTORY.create("storage-set" /* AppCheckError.STORAGE_WRITE */, {
- originalErrorMessage: event.target.error?.message
- }));
- };
- });
-}
-async function read(key) {
- const db = await getDBPromise();
- const transaction = db.transaction(STORE_NAME, 'readonly');
- const store = transaction.objectStore(STORE_NAME);
- const request = store.get(key);
- return new Promise((resolve, reject) => {
- request.onsuccess = event => {
- const result = event.target.result;
- if (result) {
- resolve(result.value);
- }
- else {
- resolve(undefined);
- }
- };
- transaction.onerror = event => {
- reject(ERROR_FACTORY.create("storage-get" /* AppCheckError.STORAGE_GET */, {
- originalErrorMessage: event.target.error?.message
- }));
- };
- });
-}
-function computeKey(app) {
- return `${app.options.appId}-${app.name}`;
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const logger = new Logger('@firebase/app-check');
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Always resolves. In case of an error reading from indexeddb, resolve with undefined
- */
-async function readTokenFromStorage(app) {
- if (isIndexedDBAvailable()) {
- let token = undefined;
- try {
- token = await readTokenFromIndexedDB(app);
- }
- catch (e) {
- // swallow the error and return undefined
- logger.warn(`Failed to read token from IndexedDB. Error: ${e}`);
- }
- return token;
- }
- return undefined;
-}
-/**
- * Always resolves. In case of an error writing to indexeddb, print a warning and resolve the promise
- */
-function writeTokenToStorage(app, token) {
- if (isIndexedDBAvailable()) {
- return writeTokenToIndexedDB(app, token).catch(e => {
- // swallow the error and resolve the promise
- logger.warn(`Failed to write token to IndexedDB. Error: ${e}`);
- });
- }
- return Promise.resolve();
-}
-async function readOrCreateDebugTokenFromStorage() {
- /**
- * Theoretically race condition can happen if we read, then write in 2 separate transactions.
- * But it won't happen here, because this function will be called exactly once.
- */
- let existingDebugToken = undefined;
- try {
- existingDebugToken = await readDebugTokenFromIndexedDB();
- }
- catch (_e) {
- // failed to read from indexeddb. We assume there is no existing debug token, and generate a new one.
- }
- if (!existingDebugToken) {
- // create a new debug token
- // This function is only available in secure contexts. See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
- const newToken = crypto.randomUUID();
- // We don't need to block on writing to indexeddb
- // In case persistence failed, a new debug token will be generated every time the page is refreshed.
- // It renders the debug token useless because you have to manually register(whitelist) the new token in the firebase console again and again.
- // If you see this error trying to use debug token, it probably means you are using a browser that doesn't support indexeddb.
- // You should switch to a different browser that supports indexeddb
- writeDebugTokenToIndexedDB(newToken).catch(e => logger.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`));
- return newToken;
- }
- else {
- return existingDebugToken;
- }
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-function isDebugMode() {
- const debugState = getDebugState();
- return debugState.enabled;
-}
-async function getDebugToken() {
- const state = getDebugState();
- if (state.enabled && state.token) {
- return state.token.promise;
- }
- else {
- // should not happen!
- throw Error(`
- Can't get debug token in production mode.
- `);
- }
-}
-function initializeDebugMode() {
- const globals = getGlobal();
- const debugState = getDebugState();
- // Set to true if this function has been called, whether or not
- // it enabled debug mode.
- debugState.initialized = true;
- if (typeof globals.FIREBASE_APPCHECK_DEBUG_TOKEN !== 'string' &&
- globals.FIREBASE_APPCHECK_DEBUG_TOKEN !== true) {
- return;
- }
- debugState.enabled = true;
- const deferredToken = new Deferred();
- debugState.token = deferredToken;
- if (typeof globals.FIREBASE_APPCHECK_DEBUG_TOKEN === 'string') {
- deferredToken.resolve(globals.FIREBASE_APPCHECK_DEBUG_TOKEN);
- }
- else {
- deferredToken.resolve(readOrCreateDebugTokenFromStorage());
- }
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// Initial hardcoded value agreed upon across platforms for initial launch.
-// Format left open for possible dynamic error values and other fields in the future.
-const defaultTokenErrorData = { error: 'UNKNOWN_ERROR' };
-/**
- * Stringify and base64 encode token error data.
- *
- * @param tokenError Error data, currently hardcoded.
- */
-function formatDummyToken(tokenErrorData) {
- return base64.encodeString(JSON.stringify(tokenErrorData),
- /* webSafe= */ false);
-}
-/**
- * This function always resolves.
- * The result will contain an error field if there is any error.
- * In case there is an error, the token field in the result will be populated with a dummy value
- */
-async function getToken$2(appCheck, forceRefresh = false, shouldLogErrors = false) {
- const app = appCheck.app;
- ensureActivated(app);
- const state = getStateReference(app);
- /**
- * First check if there is a token in memory from a previous `getToken()` call.
- */
- let token = state.token;
- let error = undefined;
- /**
- * If an invalid token was found in memory, clear token from
- * memory and unset the local variable `token`.
- */
- if (token && !isValid(token)) {
- state.token = undefined;
- token = undefined;
- }
- /**
- * If there is no valid token in memory, try to load token from indexedDB.
- */
- if (!token) {
- // cachedTokenPromise contains the token found in IndexedDB or undefined if not found.
- const cachedToken = await state.cachedTokenPromise;
- if (cachedToken) {
- if (isValid(cachedToken)) {
- token = cachedToken;
- }
- else {
- // If there was an invalid token in the indexedDB cache, clear it.
- await writeTokenToStorage(app, undefined);
- }
- }
- }
- // Return the cached token (from either memory or indexedDB) if it's valid
- if (!forceRefresh && token && isValid(token)) {
- return {
- token: token.token
- };
- }
- // Only set to true if this `getToken()` call is making the actual
- // REST call to the exchange endpoint, versus waiting for an already
- // in-flight call (see debug and regular exchange endpoint paths below)
- let shouldCallListeners = false;
- /**
- * DEBUG MODE
- * If debug mode is set, and there is no cached token, fetch a new App
- * Check token using the debug token, and return it directly.
- */
- if (isDebugMode()) {
- try {
- // Avoid making another call to the exchange endpoint if one is in flight.
- if (!state.exchangeTokenPromise) {
- state.exchangeTokenPromise = exchangeToken(getExchangeDebugTokenRequest(app, await getDebugToken()), appCheck.heartbeatServiceProvider).finally(() => {
- // Clear promise when settled - either resolved or rejected.
- state.exchangeTokenPromise = undefined;
- });
- shouldCallListeners = true;
- }
- const tokenFromDebugExchange = await state.exchangeTokenPromise;
- // Write debug token to indexedDB.
- await writeTokenToStorage(app, tokenFromDebugExchange);
- // Write debug token to state.
- state.token = tokenFromDebugExchange;
- return { token: tokenFromDebugExchange.token };
- }
- catch (e) {
- if (e.code === `appCheck/${"throttled" /* AppCheckError.THROTTLED */}` ||
- e.code ===
- `appCheck/${"initial-throttle" /* AppCheckError.INITIAL_THROTTLE */}`) {
- // Warn if throttled, but do not treat it as an error.
- logger.warn(e.message);
- }
- else if (shouldLogErrors) {
- logger.error(e);
- }
- // Return dummy token and error
- return makeDummyTokenResult(e);
- }
- }
- /**
- * There are no valid tokens in memory or indexedDB and we are not in
- * debug mode.
- * Request a new token from the exchange endpoint.
- */
- try {
- // Avoid making another call to the exchange endpoint if one is in flight.
- if (!state.exchangeTokenPromise) {
- // state.provider is populated in initializeAppCheck()
- // ensureActivated() at the top of this function checks that
- // initializeAppCheck() has been called.
- state.exchangeTokenPromise = state.provider.getToken().finally(() => {
- // Clear promise when settled - either resolved or rejected.
- state.exchangeTokenPromise = undefined;
- });
- shouldCallListeners = true;
- }
- token = await getStateReference(app).exchangeTokenPromise;
- }
- catch (e) {
- if (e.code === `appCheck/${"throttled" /* AppCheckError.THROTTLED */}` ||
- e.code === `appCheck/${"initial-throttle" /* AppCheckError.INITIAL_THROTTLE */}`) {
- // Warn if throttled, but do not treat it as an error.
- logger.warn(e.message);
- }
- else if (shouldLogErrors) {
- logger.error(e);
- }
- // Always save error to be added to dummy token.
- error = e;
- }
- let interopTokenResult;
- if (!token) {
- // If token is undefined, there must be an error.
- // Return a dummy token along with the error.
- interopTokenResult = makeDummyTokenResult(error);
- }
- else if (error) {
- if (isValid(token)) {
- // It's also possible a valid token exists, but there's also an error.
- // (Such as if the token is almost expired, tries to refresh, and
- // the exchange request fails.)
- // We add a special error property here so that the refresher will
- // count this as a failed attempt and use the backoff instead of
- // retrying repeatedly with no delay, but any 3P listeners will not
- // be hindered in getting the still-valid token.
- interopTokenResult = {
- token: token.token,
- internalError: error
- };
- }
- else {
- // No invalid tokens should make it to this step. Memory and cached tokens
- // are checked. Other tokens are from fresh exchanges. But just in case.
- interopTokenResult = makeDummyTokenResult(error);
- }
- }
- else {
- interopTokenResult = {
- token: token.token
- };
- // write the new token to the memory state as well as the persistent storage.
- // Only do it if we got a valid new token
- state.token = token;
- await writeTokenToStorage(app, token);
- }
- if (shouldCallListeners) {
- notifyTokenListeners(app, interopTokenResult);
- }
- return interopTokenResult;
-}
-/**
- * Internal API for limited use tokens. Skips all FAC state and simply calls
- * the underlying provider.
- */
-async function getLimitedUseToken$1(appCheck) {
- const app = appCheck.app;
- ensureActivated(app);
- const { provider } = getStateReference(app);
- if (isDebugMode()) {
- const debugToken = await getDebugToken();
- const { token } = await exchangeToken(getExchangeDebugTokenRequest(app, debugToken), appCheck.heartbeatServiceProvider);
- return { token };
- }
- else {
- // provider is definitely valid since we ensure AppCheck was activated
- const { token } = await provider.getToken();
- return { token };
- }
-}
-function addTokenListener(appCheck, type, listener, onError) {
- const { app } = appCheck;
- const state = getStateReference(app);
- const tokenObserver = {
- next: listener,
- error: onError,
- type
- };
- state.tokenObservers = [...state.tokenObservers, tokenObserver];
- // Invoke the listener async immediately if there is a valid token
- // in memory.
- if (state.token && isValid(state.token)) {
- const validToken = state.token;
- Promise.resolve()
- .then(() => {
- listener({ token: validToken.token });
- initTokenRefresher(appCheck);
- })
- .catch(() => {
- /* we don't care about exceptions thrown in listeners */
- });
- }
- /**
- * Wait for any cached token promise to resolve before starting the token
- * refresher. The refresher checks to see if there is an existing token
- * in state and calls the exchange endpoint if not. We should first let the
- * IndexedDB check have a chance to populate state if it can.
- *
- * Listener call isn't needed here because cachedTokenPromise will call any
- * listeners that exist when it resolves.
- */
- // state.cachedTokenPromise is always populated in `activate()`.
- void state.cachedTokenPromise.then(() => initTokenRefresher(appCheck));
-}
-function removeTokenListener(app, listener) {
- const state = getStateReference(app);
- const newObservers = state.tokenObservers.filter(tokenObserver => tokenObserver.next !== listener);
- if (newObservers.length === 0 &&
- state.tokenRefresher &&
- state.tokenRefresher.isRunning()) {
- state.tokenRefresher.stop();
- }
- state.tokenObservers = newObservers;
-}
-/**
- * Logic to create and start refresher as needed.
- */
-function initTokenRefresher(appCheck) {
- const { app } = appCheck;
- const state = getStateReference(app);
- // Create the refresher but don't start it if `isTokenAutoRefreshEnabled`
- // is not true.
- let refresher = state.tokenRefresher;
- if (!refresher) {
- refresher = createTokenRefresher(appCheck);
- state.tokenRefresher = refresher;
- }
- if (!refresher.isRunning() && state.isTokenAutoRefreshEnabled) {
- refresher.start();
- }
-}
-function createTokenRefresher(appCheck) {
- const { app } = appCheck;
- return new Refresher(
- // Keep in mind when this fails for any reason other than the ones
- // for which we should retry, it will effectively stop the proactive refresh.
- async () => {
- const state = getStateReference(app);
- // If there is no token, we will try to load it from storage and use it
- // If there is a token, we force refresh it because we know it's going to expire soon
- let result;
- if (!state.token) {
- result = await getToken$2(appCheck);
- }
- else {
- result = await getToken$2(appCheck, true);
- }
- /**
- * getToken() always resolves. In case the result has an error field defined, it means
- * the operation failed, and we should retry.
- */
- if (result.error) {
- throw result.error;
- }
- /**
- * A special `internalError` field reflects that there was an error
- * getting a new token from the exchange endpoint, but there's still a
- * previous token that's valid for now and this should be passed to 2P/3P
- * requests for a token. But we want this callback (`this.operation` in
- * `Refresher`) to throw in order to kick off the Refresher's retry
- * backoff. (Setting `hasSucceeded` to false.)
- */
- if (result.internalError) {
- throw result.internalError;
- }
- }, () => {
- return true;
- }, () => {
- const state = getStateReference(app);
- if (state.token) {
- // issuedAtTime + (50% * total TTL) + 5 minutes
- let nextRefreshTimeMillis = state.token.issuedAtTimeMillis +
- (state.token.expireTimeMillis - state.token.issuedAtTimeMillis) *
- 0.5 +
- 5 * 60 * 1000;
- // Do not allow refresh time to be past (expireTime - 5 minutes)
- const latestAllowableRefresh = state.token.expireTimeMillis - 5 * 60 * 1000;
- nextRefreshTimeMillis = Math.min(nextRefreshTimeMillis, latestAllowableRefresh);
- return Math.max(0, nextRefreshTimeMillis - Date.now());
- }
- else {
- return 0;
- }
- }, TOKEN_REFRESH_TIME.RETRIAL_MIN_WAIT, TOKEN_REFRESH_TIME.RETRIAL_MAX_WAIT);
-}
-function notifyTokenListeners(app, token) {
- const observers = getStateReference(app).tokenObservers;
- for (const observer of observers) {
- try {
- if (observer.type === "EXTERNAL" /* ListenerType.EXTERNAL */ && token.error != null) {
- // If this listener was added by a 3P call, send any token error to
- // the supplied error handler. A 3P observer always has an error
- // handler.
- observer.error(token.error);
- }
- else {
- // If the token has no error field, always return the token.
- // If this is a 2P listener, return the token, whether or not it
- // has an error field.
- observer.next(token);
- }
- }
- catch (e) {
- // Errors in the listener function itself are always ignored.
- }
- }
-}
-function isValid(token) {
- return token.expireTimeMillis - Date.now() > 0;
-}
-function makeDummyTokenResult(error) {
- return {
- token: formatDummyToken(defaultTokenErrorData),
- error
- };
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * AppCheck Service class.
- */
-class AppCheckService {
- constructor(app, heartbeatServiceProvider) {
- this.app = app;
- this.heartbeatServiceProvider = heartbeatServiceProvider;
- }
- _delete() {
- const { tokenObservers } = getStateReference(this.app);
- for (const tokenObserver of tokenObservers) {
- removeTokenListener(this.app, tokenObserver.next);
- }
- return Promise.resolve();
- }
-}
-function factory(app, heartbeatServiceProvider) {
- return new AppCheckService(app, heartbeatServiceProvider);
-}
-function internalFactory(appCheck) {
- return {
- getToken: forceRefresh => getToken$2(appCheck, forceRefresh),
- getLimitedUseToken: () => getLimitedUseToken$1(appCheck),
- addTokenListener: listener => addTokenListener(appCheck, "INTERNAL" /* ListenerType.INTERNAL */, listener),
- removeTokenListener: listener => removeTokenListener(appCheck.app, listener)
- };
-}
-
-const name = "@firebase/app-check";
-const version = "0.11.0";
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const RECAPTCHA_URL = 'https://www.google.com/recaptcha/api.js';
-const RECAPTCHA_ENTERPRISE_URL = 'https://www.google.com/recaptcha/enterprise.js';
-function initializeV3(app, siteKey) {
- const initialized = new Deferred();
- const state = getStateReference(app);
- state.reCAPTCHAState = { initialized };
- const divId = makeDiv(app);
- const grecaptcha = getRecaptcha(false);
- if (!grecaptcha) {
- loadReCAPTCHAV3Script(() => {
- const grecaptcha = getRecaptcha(false);
- if (!grecaptcha) {
- // it shouldn't happen.
- throw new Error('no recaptcha');
- }
- queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);
- });
- }
- else {
- queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);
- }
- return initialized.promise;
-}
-function initializeEnterprise(app, siteKey) {
- const initialized = new Deferred();
- const state = getStateReference(app);
- state.reCAPTCHAState = { initialized };
- const divId = makeDiv(app);
- const grecaptcha = getRecaptcha(true);
- if (!grecaptcha) {
- loadReCAPTCHAEnterpriseScript(() => {
- const grecaptcha = getRecaptcha(true);
- if (!grecaptcha) {
- // it shouldn't happen.
- throw new Error('no recaptcha');
- }
- queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);
- });
- }
- else {
- queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);
- }
- return initialized.promise;
-}
-/**
- * Add listener to render the widget and resolve the promise when
- * the grecaptcha.ready() event fires.
- */
-function queueWidgetRender(app, siteKey, grecaptcha, container, initialized) {
- grecaptcha.ready(() => {
- // Invisible widgets allow us to set a different siteKey for each widget,
- // so we use them to support multiple apps
- renderInvisibleWidget(app, siteKey, grecaptcha, container);
- initialized.resolve(grecaptcha);
- });
-}
-/**
- * Add invisible div to page.
- */
-function makeDiv(app) {
- const divId = `fire_app_check_${app.name}`;
- const invisibleDiv = document.createElement('div');
- invisibleDiv.id = divId;
- invisibleDiv.style.display = 'none';
- document.body.appendChild(invisibleDiv);
- return divId;
-}
-async function getToken$1(app) {
- ensureActivated(app);
- // ensureActivated() guarantees that reCAPTCHAState is set
- const reCAPTCHAState = getStateReference(app).reCAPTCHAState;
- const recaptcha = await reCAPTCHAState.initialized.promise;
- return new Promise((resolve, _reject) => {
- // Updated after initialization is complete.
- const reCAPTCHAState = getStateReference(app).reCAPTCHAState;
- recaptcha.ready(() => {
- resolve(
- // widgetId is guaranteed to be available if reCAPTCHAState.initialized.promise resolved.
- recaptcha.execute(reCAPTCHAState.widgetId, {
- action: 'fire_app_check'
- }));
- });
- });
-}
-/**
- *
- * @param app
- * @param container - Id of a HTML element.
- */
-function renderInvisibleWidget(app, siteKey, grecaptcha, container) {
- const widgetId = grecaptcha.render(container, {
- sitekey: siteKey,
- size: 'invisible',
- // Success callback - set state
- callback: () => {
- getStateReference(app).reCAPTCHAState.succeeded = true;
- },
- // Failure callback - set state
- 'error-callback': () => {
- getStateReference(app).reCAPTCHAState.succeeded = false;
- }
- });
- const state = getStateReference(app);
- state.reCAPTCHAState = {
- ...state.reCAPTCHAState, // state.reCAPTCHAState is set in the initialize()
- widgetId
- };
-}
-function loadReCAPTCHAV3Script(onload) {
- const script = document.createElement('script');
- script.src = RECAPTCHA_URL;
- script.onload = onload;
- document.head.appendChild(script);
-}
-function loadReCAPTCHAEnterpriseScript(onload) {
- const script = document.createElement('script');
- script.src = RECAPTCHA_ENTERPRISE_URL;
- script.onload = onload;
- document.head.appendChild(script);
-}
-
-/**
- * @license
- * Copyright 2021 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * App Check provider that can obtain a reCAPTCHA V3 token and exchange it
- * for an App Check token.
- *
- * @public
- */
-class ReCaptchaV3Provider {
- /**
- * Create a ReCaptchaV3Provider instance.
- * @param siteKey - ReCAPTCHA V3 siteKey.
- */
- constructor(_siteKey) {
- this._siteKey = _siteKey;
- /**
- * Throttle requests on certain error codes to prevent too many retries
- * in a short time.
- */
- this._throttleData = null;
- }
- /**
- * Returns an App Check token.
- * @internal
- */
- async getToken() {
- throwIfThrottled(this._throttleData);
- // Top-level `getToken()` has already checked that App Check is initialized
- // and therefore this._app and this._heartbeatServiceProvider are available.
- const attestedClaimsToken = await getToken$1(this._app).catch(_e => {
- // reCaptcha.execute() throws null which is not very descriptive.
- throw ERROR_FACTORY.create("recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */);
- });
- // Check if a failure state was set by the recaptcha "error-callback".
- if (!getStateReference(this._app).reCAPTCHAState?.succeeded) {
- throw ERROR_FACTORY.create("recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */);
- }
- let result;
- try {
- result = await exchangeToken(getExchangeRecaptchaV3TokenRequest(this._app, attestedClaimsToken), this._heartbeatServiceProvider);
- }
- catch (e) {
- if (e.code?.includes("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */)) {
- this._throttleData = setBackoff(Number(e.customData?.httpStatus), this._throttleData);
- throw ERROR_FACTORY.create("initial-throttle" /* AppCheckError.INITIAL_THROTTLE */, {
- time: getDurationString(this._throttleData.allowRequestsAfter - Date.now()),
- httpStatus: this._throttleData.httpStatus
- });
- }
- else {
- throw e;
- }
- }
- // If successful, clear throttle data.
- this._throttleData = null;
- return result;
- }
- /**
- * @internal
- */
- initialize(app) {
- this._app = app;
- this._heartbeatServiceProvider = _getProvider(app, 'heartbeat');
- initializeV3(app, this._siteKey).catch(() => {
- /* we don't care about the initialization result */
- });
- }
- /**
- * @internal
- */
- isEqual(otherProvider) {
- if (otherProvider instanceof ReCaptchaV3Provider) {
- return this._siteKey === otherProvider._siteKey;
- }
- else {
- return false;
- }
- }
-}
-/**
- * App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it
- * for an App Check token.
- *
- * @public
- */
-class ReCaptchaEnterpriseProvider {
- /**
- * Create a ReCaptchaEnterpriseProvider instance.
- * @param siteKey - reCAPTCHA Enterprise score-based site key.
- */
- constructor(_siteKey) {
- this._siteKey = _siteKey;
- /**
- * Throttle requests on certain error codes to prevent too many retries
- * in a short time.
- */
- this._throttleData = null;
- }
- /**
- * Returns an App Check token.
- * @internal
- */
- async getToken() {
- throwIfThrottled(this._throttleData);
- // Top-level `getToken()` has already checked that App Check is initialized
- // and therefore this._app and this._heartbeatServiceProvider are available.
- const attestedClaimsToken = await getToken$1(this._app).catch(_e => {
- // reCaptcha.execute() throws null which is not very descriptive.
- throw ERROR_FACTORY.create("recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */);
- });
- // Check if a failure state was set by the recaptcha "error-callback".
- if (!getStateReference(this._app).reCAPTCHAState?.succeeded) {
- throw ERROR_FACTORY.create("recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */);
- }
- let result;
- try {
- result = await exchangeToken(getExchangeRecaptchaEnterpriseTokenRequest(this._app, attestedClaimsToken), this._heartbeatServiceProvider);
- }
- catch (e) {
- if (e.code?.includes("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */)) {
- this._throttleData = setBackoff(Number(e.customData?.httpStatus), this._throttleData);
- throw ERROR_FACTORY.create("initial-throttle" /* AppCheckError.INITIAL_THROTTLE */, {
- time: getDurationString(this._throttleData.allowRequestsAfter - Date.now()),
- httpStatus: this._throttleData.httpStatus
- });
- }
- else {
- throw e;
- }
- }
- // If successful, clear throttle data.
- this._throttleData = null;
- return result;
- }
- /**
- * @internal
- */
- initialize(app) {
- this._app = app;
- this._heartbeatServiceProvider = _getProvider(app, 'heartbeat');
- initializeEnterprise(app, this._siteKey).catch(() => {
- /* we don't care about the initialization result */
- });
- }
- /**
- * @internal
- */
- isEqual(otherProvider) {
- if (otherProvider instanceof ReCaptchaEnterpriseProvider) {
- return this._siteKey === otherProvider._siteKey;
- }
- else {
- return false;
- }
- }
-}
-/**
- * Custom provider class.
- * @public
- */
-class CustomProvider {
- constructor(_customProviderOptions) {
- this._customProviderOptions = _customProviderOptions;
- }
- /**
- * @internal
- */
- async getToken() {
- // custom provider
- const customToken = await this._customProviderOptions.getToken();
- // Try to extract IAT from custom token, in case this token is not
- // being newly issued. JWT timestamps are in seconds since epoch.
- const issuedAtTimeSeconds = issuedAtTime(customToken.token);
- // Very basic validation, use current timestamp as IAT if JWT
- // has no `iat` field or value is out of bounds.
- const issuedAtTimeMillis = issuedAtTimeSeconds !== null &&
- issuedAtTimeSeconds < Date.now() &&
- issuedAtTimeSeconds > 0
- ? issuedAtTimeSeconds * 1000
- : Date.now();
- return { ...customToken, issuedAtTimeMillis };
- }
- /**
- * @internal
- */
- initialize(app) {
- this._app = app;
- }
- /**
- * @internal
- */
- isEqual(otherProvider) {
- if (otherProvider instanceof CustomProvider) {
- return (this._customProviderOptions.getToken.toString() ===
- otherProvider._customProviderOptions.getToken.toString());
- }
- else {
- return false;
- }
- }
-}
-/**
- * Set throttle data to block requests until after a certain time
- * depending on the failed request's status code.
- * @param httpStatus - Status code of failed request.
- * @param throttleData - `ThrottleData` object containing previous throttle
- * data state.
- * @returns Data about current throttle state and expiration time.
- */
-function setBackoff(httpStatus, throttleData) {
- /**
- * Block retries for 1 day for the following error codes:
- *
- * 404: Likely malformed URL.
- *
- * 403:
- * - Attestation failed
- * - Wrong API key
- * - Project deleted
- */
- if (httpStatus === 404 || httpStatus === 403) {
- return {
- backoffCount: 1,
- allowRequestsAfter: Date.now() + ONE_DAY,
- httpStatus
- };
- }
- else {
- /**
- * For all other error codes, the time when it is ok to retry again
- * is based on exponential backoff.
- */
- const backoffCount = throttleData ? throttleData.backoffCount : 0;
- const backoffMillis = calculateBackoffMillis(backoffCount, 1000, 2);
- return {
- backoffCount: backoffCount + 1,
- allowRequestsAfter: Date.now() + backoffMillis,
- httpStatus
- };
- }
-}
-function throwIfThrottled(throttleData) {
- if (throttleData) {
- if (Date.now() - throttleData.allowRequestsAfter <= 0) {
- // If before, throw.
- throw ERROR_FACTORY.create("throttled" /* AppCheckError.THROTTLED */, {
- time: getDurationString(throttleData.allowRequestsAfter - Date.now()),
- httpStatus: throttleData.httpStatus
- });
- }
- }
-}
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Activate App Check for the given app. Can be called only once per app.
- * @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for
- * @param options - App Check initialization options
- * @public
- */
-function initializeAppCheck(app = getApp(), options) {
- app = getModularInstance(app);
- const provider = _getProvider(app, 'app-check');
- // Ensure initializeDebugMode() is only called once.
- if (!getDebugState().initialized) {
- initializeDebugMode();
- }
- // Log a message containing the debug token when `initializeAppCheck()`
- // is called in debug mode.
- if (isDebugMode()) {
- // Do not block initialization to get the token for the message.
- void getDebugToken().then(token =>
- // Not using logger because I don't think we ever want this accidentally hidden.
- console.log(`App Check debug token: ${token}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`));
- }
- if (provider.isInitialized()) {
- const existingInstance = provider.getImmediate();
- const initialOptions = provider.getOptions();
- if (initialOptions.isTokenAutoRefreshEnabled ===
- options.isTokenAutoRefreshEnabled &&
- initialOptions.provider.isEqual(options.provider)) {
- return existingInstance;
- }
- else {
- throw ERROR_FACTORY.create("already-initialized" /* AppCheckError.ALREADY_INITIALIZED */, {
- appName: app.name
- });
- }
- }
- const appCheck = provider.initialize({ options });
- _activate(app, options.provider, options.isTokenAutoRefreshEnabled);
- // If isTokenAutoRefreshEnabled is false, do not send any requests to the
- // exchange endpoint without an explicit call from the user either directly
- // or through another Firebase library (storage, functions, etc.)
- if (getStateReference(app).isTokenAutoRefreshEnabled) {
- // Adding a listener will start the refresher and fetch a token if needed.
- // This gets a token ready and prevents a delay when an internal library
- // requests the token.
- // Listener function does not need to do anything, its base functionality
- // of calling getToken() already fetches token and writes it to memory/storage.
- addTokenListener(appCheck, "INTERNAL" /* ListenerType.INTERNAL */, () => { });
- }
- return appCheck;
-}
-/**
- * Activate App Check
- * @param app - Firebase app to activate App Check for.
- * @param provider - reCAPTCHA v3 provider or
- * custom token provider.
- * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
- * refreshes App Check tokens as needed. If undefined, defaults to the
- * value of `app.automaticDataCollectionEnabled`, which defaults to
- * false and can be set in the app config.
- */
-function _activate(app, provider, isTokenAutoRefreshEnabled = false) {
- // Create an entry in the APP_CHECK_STATES map. Further changes should
- // directly mutate this object.
- const state = setInitialState(app, { ...DEFAULT_STATE });
- state.activated = true;
- state.provider = provider; // Read cached token from storage if it exists and store it in memory.
- state.cachedTokenPromise = readTokenFromStorage(app).then(cachedToken => {
- if (cachedToken && isValid(cachedToken)) {
- state.token = cachedToken;
- // notify all listeners with the cached token
- notifyTokenListeners(app, { token: cachedToken.token });
- }
- return cachedToken;
- });
- // Global `automaticDataCollectionEnabled` (defaults to true) and
- // `isTokenAutoRefreshEnabled` must both be true.
- state.isTokenAutoRefreshEnabled =
- isTokenAutoRefreshEnabled && app.automaticDataCollectionEnabled;
- if (!app.automaticDataCollectionEnabled && isTokenAutoRefreshEnabled) {
- logger.warn('`isTokenAutoRefreshEnabled` is true but ' +
- '`automaticDataCollectionEnabled` was set to false during' +
- ' `initializeApp()`. This blocks automatic token refresh.');
- }
- state.provider.initialize(app);
-}
-/**
- * Set whether App Check will automatically refresh tokens as needed.
- *
- * @param appCheckInstance - The App Check service instance.
- * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
- * refreshes App Check tokens as needed. This overrides any value set
- * during `initializeAppCheck()`.
- * @public
- */
-function setTokenAutoRefreshEnabled(appCheckInstance, isTokenAutoRefreshEnabled) {
- const app = appCheckInstance.app;
- const state = getStateReference(app);
- // This will exist if any product libraries have called
- // `addTokenListener()`
- if (state.tokenRefresher) {
- if (isTokenAutoRefreshEnabled === true) {
- state.tokenRefresher.start();
- }
- else {
- state.tokenRefresher.stop();
- }
- }
- state.isTokenAutoRefreshEnabled = isTokenAutoRefreshEnabled;
-}
-/**
- * Get the current App Check token. If `forceRefresh` is false, this function first
- * checks for a valid token in memory, then local persistence (IndexedDB).
- * If not found, or if `forceRefresh` is true, it makes a request to the
- * App Check endpoint for a fresh token. That request attaches
- * to the most recent in-flight request if one is present.
- *
- * @param appCheckInstance - The App Check service instance.
- * @param forceRefresh - If true, will always try to fetch a fresh token.
- * If false, will use a cached token if found in storage.
- * @public
- */
-async function getToken(appCheckInstance, forceRefresh) {
- const result = await getToken$2(appCheckInstance, forceRefresh);
- if (result.error) {
- throw result.error;
- }
- if (result.internalError) {
- throw result.internalError;
- }
- return { token: result.token };
-}
-/**
- * Requests a Firebase App Check token. This method should be used
- * only if you need to authorize requests to a non-Firebase backend.
- *
- * Returns limited-use tokens that are intended for use with your
- * non-Firebase backend endpoints that are protected with
- * <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
- * Replay Protection</a>. This method
- * does not affect the token generation behavior of the
- * #getAppCheckToken() method.
- *
- * @param appCheckInstance - The App Check service instance.
- * @returns The limited use token.
- * @public
- */
-function getLimitedUseToken(appCheckInstance) {
- return getLimitedUseToken$1(appCheckInstance);
-}
-/**
- * Wraps `addTokenListener`/`removeTokenListener` methods in an `Observer`
- * pattern for public use.
- */
-function onTokenChanged(appCheckInstance, onNextOrObserver, onError,
-/**
- * NOTE: Although an `onCompletion` callback can be provided, it will
- * never be called because the token stream is never-ending.
- * It is added only for API consistency with the observer pattern, which
- * we follow in JS APIs.
- */
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-onCompletion) {
- let nextFn = () => { };
- let errorFn = () => { };
- if (onNextOrObserver.next != null) {
- nextFn = onNextOrObserver.next.bind(onNextOrObserver);
- }
- else {
- nextFn = onNextOrObserver;
- }
- if (onNextOrObserver.error != null) {
- errorFn = onNextOrObserver.error.bind(onNextOrObserver);
- }
- else if (onError) {
- errorFn = onError;
- }
- addTokenListener(appCheckInstance, "EXTERNAL" /* ListenerType.EXTERNAL */, nextFn, errorFn);
- return () => removeTokenListener(appCheckInstance.app, nextFn);
-}
-
-/**
- * The Firebase App Check Web SDK.
- *
- * @remarks
- * Firebase App Check does not work in a Node.js environment using `ReCaptchaV3Provider` or
- * `ReCaptchaEnterpriseProvider`, but can be used in Node.js if you use
- * `CustomProvider` and write your own attestation method.
- *
- * @packageDocumentation
- */
-const APP_CHECK_NAME = 'app-check';
-const APP_CHECK_NAME_INTERNAL = 'app-check-internal';
-function registerAppCheck() {
- // The public interface
- _registerComponent(new Component(APP_CHECK_NAME, container => {
- // getImmediate for FirebaseApp will always succeed
- const app = container.getProvider('app').getImmediate();
- const heartbeatServiceProvider = container.getProvider('heartbeat');
- return factory(app, heartbeatServiceProvider);
- }, "PUBLIC" /* ComponentType.PUBLIC */)
- .setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
- /**
- * Initialize app-check-internal after app-check is initialized to make AppCheck available to
- * other Firebase SDKs
- */
- .setInstanceCreatedCallback((container, _identifier, _appcheckService) => {
- container.getProvider(APP_CHECK_NAME_INTERNAL).initialize();
- }));
- // The internal interface used by other Firebase products
- _registerComponent(new Component(APP_CHECK_NAME_INTERNAL, container => {
- const appCheck = container.getProvider('app-check').getImmediate();
- return internalFactory(appCheck);
- }, "PUBLIC" /* ComponentType.PUBLIC */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
- registerVersion(name, version);
-}
-registerAppCheck();
-
-export { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider, getLimitedUseToken, getToken, initializeAppCheck, onTokenChanged, setTokenAutoRefreshEnabled };
-//# sourceMappingURL=index.esm.js.map
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/index.esm.js.map b/frontend-old/node_modules/@firebase/app-check/dist/esm/index.esm.js.map
deleted file mode 100644
index cc29023..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/index.esm.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"index.esm.js","sources":["../../src/state.ts","../../src/constants.ts","../../src/proactive-refresh.ts","../../src/errors.ts","../../src/util.ts","../../src/client.ts","../../src/indexeddb.ts","../../src/logger.ts","../../src/storage.ts","../../src/debug.ts","../../src/internal-api.ts","../../src/factory.ts","../../src/recaptcha.ts","../../src/providers.ts","../../src/api.ts","../../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp } from '@firebase/app';\nimport {\n AppCheckProvider,\n AppCheckTokenInternal,\n AppCheckTokenObserver\n} from './types';\nimport { Refresher } from './proactive-refresh';\nimport { Deferred } from '@firebase/util';\nimport { GreCAPTCHA } from './recaptcha';\nexport interface AppCheckState {\n activated: boolean;\n tokenObservers: AppCheckTokenObserver[];\n provider?: AppCheckProvider;\n token?: AppCheckTokenInternal;\n cachedTokenPromise?: Promise<AppCheckTokenInternal | undefined>;\n exchangeTokenPromise?: Promise<AppCheckTokenInternal>;\n tokenRefresher?: Refresher;\n reCAPTCHAState?: ReCAPTCHAState;\n isTokenAutoRefreshEnabled?: boolean;\n}\n\nexport interface ReCAPTCHAState {\n initialized: Deferred<GreCAPTCHA>;\n widgetId?: string;\n // True if the most recent recaptcha check succeeded.\n succeeded?: boolean;\n}\n\nexport interface DebugState {\n initialized: boolean;\n enabled: boolean;\n token?: Deferred<string>;\n}\n\nconst APP_CHECK_STATES = new Map<FirebaseApp, AppCheckState>();\nexport const DEFAULT_STATE: AppCheckState = {\n activated: false,\n tokenObservers: []\n};\n\nconst DEBUG_STATE: DebugState = {\n initialized: false,\n enabled: false\n};\n\n/**\n * Gets a reference to the state object.\n */\nexport function getStateReference(app: FirebaseApp): AppCheckState {\n return APP_CHECK_STATES.get(app) || { ...DEFAULT_STATE };\n}\n\n/**\n * Set once on initialization. The map should hold the same reference to the\n * same object until this entry is deleted.\n */\nexport function setInitialState(\n app: FirebaseApp,\n state: AppCheckState\n): AppCheckState {\n APP_CHECK_STATES.set(app, state);\n return APP_CHECK_STATES.get(app) as AppCheckState;\n}\n\n// for testing only\nexport function clearState(): void {\n APP_CHECK_STATES.clear();\n DEBUG_STATE.enabled = false;\n DEBUG_STATE.token = undefined;\n DEBUG_STATE.initialized = false;\n}\n\nexport function getDebugState(): DebugState {\n return DEBUG_STATE;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const BASE_ENDPOINT =\n 'https://content-firebaseappcheck.googleapis.com/v1';\n\nexport const EXCHANGE_RECAPTCHA_TOKEN_METHOD = 'exchangeRecaptchaV3Token';\nexport const EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD =\n 'exchangeRecaptchaEnterpriseToken';\nexport const EXCHANGE_DEBUG_TOKEN_METHOD = 'exchangeDebugToken';\n\nexport const TOKEN_REFRESH_TIME = {\n /**\n * The offset time before token natural expiration to run the refresh.\n * This is currently 5 minutes.\n */\n OFFSET_DURATION: 5 * 60 * 1000,\n /**\n * This is the first retrial wait after an error. This is currently\n * 30 seconds.\n */\n RETRIAL_MIN_WAIT: 30 * 1000,\n /**\n * This is the maximum retrial wait, currently 16 minutes.\n */\n RETRIAL_MAX_WAIT: 16 * 60 * 1000\n};\n\n/**\n * One day in millis, for certain error code backoffs.\n */\nexport const ONE_DAY = 24 * 60 * 60 * 1000;\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Deferred } from '@firebase/util';\n\n/**\n * Port from auth proactiverefresh.js\n *\n */\n// TODO: move it to @firebase/util?\n// TODO: allow to config whether refresh should happen in the background\nexport class Refresher {\n private pending: Deferred<unknown> | null = null;\n private nextErrorWaitInterval: number;\n constructor(\n private readonly operation: () => Promise<unknown>,\n private readonly retryPolicy: (error: unknown) => boolean,\n private readonly getWaitDuration: () => number,\n private readonly lowerBound: number,\n private readonly upperBound: number\n ) {\n this.nextErrorWaitInterval = lowerBound;\n\n if (lowerBound > upperBound) {\n throw new Error(\n 'Proactive refresh lower bound greater than upper bound!'\n );\n }\n }\n\n start(): void {\n this.nextErrorWaitInterval = this.lowerBound;\n this.process(true).catch(() => {\n /* we don't care about the result */\n });\n }\n\n stop(): void {\n if (this.pending) {\n this.pending.reject('cancelled');\n this.pending = null;\n }\n }\n\n isRunning(): boolean {\n return !!this.pending;\n }\n\n private async process(hasSucceeded: boolean): Promise<void> {\n this.stop();\n try {\n this.pending = new Deferred();\n this.pending.promise.catch(_e => {\n /* ignore */\n });\n await sleep(this.getNextRun(hasSucceeded));\n\n // Why do we resolve a promise, then immediate wait for it?\n // We do it to make the promise chain cancellable.\n // We can call stop() which rejects the promise before the following line execute, which makes\n // the code jump to the catch block.\n // TODO: unit test this\n this.pending.resolve();\n await this.pending.promise;\n this.pending = new Deferred();\n this.pending.promise.catch(_e => {\n /* ignore */\n });\n await this.operation();\n\n this.pending.resolve();\n await this.pending.promise;\n\n this.process(true).catch(() => {\n /* we don't care about the result */\n });\n } catch (error) {\n if (this.retryPolicy(error)) {\n this.process(false).catch(() => {\n /* we don't care about the result */\n });\n } else {\n this.stop();\n }\n }\n }\n\n private getNextRun(hasSucceeded: boolean): number {\n if (hasSucceeded) {\n // If last operation succeeded, reset next error wait interval and return\n // the default wait duration.\n this.nextErrorWaitInterval = this.lowerBound;\n // Return typical wait duration interval after a successful operation.\n return this.getWaitDuration();\n } else {\n // Get next error wait interval.\n const currentErrorWaitInterval = this.nextErrorWaitInterval;\n // Double interval for next consecutive error.\n this.nextErrorWaitInterval *= 2;\n // Make sure next wait interval does not exceed the maximum upper bound.\n if (this.nextErrorWaitInterval > this.upperBound) {\n this.nextErrorWaitInterval = this.upperBound;\n }\n return currentErrorWaitInterval;\n }\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise<void>(resolve => {\n setTimeout(resolve, ms);\n });\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorFactory, ErrorMap } from '@firebase/util';\n\nexport const enum AppCheckError {\n ALREADY_INITIALIZED = 'already-initialized',\n USE_BEFORE_ACTIVATION = 'use-before-activation',\n FETCH_NETWORK_ERROR = 'fetch-network-error',\n FETCH_PARSE_ERROR = 'fetch-parse-error',\n FETCH_STATUS_ERROR = 'fetch-status-error',\n STORAGE_OPEN = 'storage-open',\n STORAGE_GET = 'storage-get',\n STORAGE_WRITE = 'storage-set',\n RECAPTCHA_ERROR = 'recaptcha-error',\n INITIAL_THROTTLE = 'initial-throttle',\n THROTTLED = 'throttled'\n}\n\nconst ERRORS: ErrorMap<AppCheckError> = {\n [AppCheckError.ALREADY_INITIALIZED]:\n 'You have already called initializeAppCheck() for FirebaseApp {$appName} with ' +\n 'different options. To avoid this error, call initializeAppCheck() with the ' +\n 'same options as when it was originally called. This will return the ' +\n 'already initialized instance.',\n [AppCheckError.USE_BEFORE_ACTIVATION]:\n 'App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. ' +\n 'Call initializeAppCheck() before instantiating other Firebase services.',\n [AppCheckError.FETCH_NETWORK_ERROR]:\n 'Fetch failed to connect to a network. Check Internet connection. ' +\n 'Original error: {$originalErrorMessage}.',\n [AppCheckError.FETCH_PARSE_ERROR]:\n 'Fetch client could not parse response.' +\n ' Original error: {$originalErrorMessage}.',\n [AppCheckError.FETCH_STATUS_ERROR]:\n 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.',\n [AppCheckError.STORAGE_OPEN]:\n 'Error thrown when opening storage. Original error: {$originalErrorMessage}.',\n [AppCheckError.STORAGE_GET]:\n 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',\n [AppCheckError.STORAGE_WRITE]:\n 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',\n [AppCheckError.RECAPTCHA_ERROR]: 'ReCAPTCHA error.',\n [AppCheckError.INITIAL_THROTTLE]: `{$httpStatus} error. Attempts allowed again after {$time}`,\n [AppCheckError.THROTTLED]: `Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}`\n};\n\ninterface ErrorParams {\n [AppCheckError.ALREADY_INITIALIZED]: { appName: string };\n [AppCheckError.USE_BEFORE_ACTIVATION]: { appName: string };\n [AppCheckError.FETCH_NETWORK_ERROR]: { originalErrorMessage: string };\n [AppCheckError.FETCH_PARSE_ERROR]: { originalErrorMessage: string };\n [AppCheckError.FETCH_STATUS_ERROR]: { httpStatus: number };\n [AppCheckError.STORAGE_OPEN]: { originalErrorMessage?: string };\n [AppCheckError.STORAGE_GET]: { originalErrorMessage?: string };\n [AppCheckError.STORAGE_WRITE]: { originalErrorMessage?: string };\n [AppCheckError.INITIAL_THROTTLE]: { time: string; httpStatus: number };\n [AppCheckError.THROTTLED]: { time: string; httpStatus: number };\n}\n\nexport const ERROR_FACTORY = new ErrorFactory<AppCheckError, ErrorParams>(\n 'appCheck',\n 'AppCheck',\n ERRORS\n);\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { GreCAPTCHA } from './recaptcha';\nimport { getStateReference } from './state';\nimport { ERROR_FACTORY, AppCheckError } from './errors';\nimport { FirebaseApp } from '@firebase/app';\n\nexport function getRecaptcha(\n isEnterprise: boolean = false\n): GreCAPTCHA | undefined {\n if (isEnterprise) {\n return self.grecaptcha?.enterprise;\n }\n return self.grecaptcha;\n}\n\nexport function ensureActivated(app: FirebaseApp): void {\n if (!getStateReference(app).activated) {\n throw ERROR_FACTORY.create(AppCheckError.USE_BEFORE_ACTIVATION, {\n appName: app.name\n });\n }\n}\n\nexport function getDurationString(durationInMillis: number): string {\n const totalSeconds = Math.round(durationInMillis / 1000);\n const days = Math.floor(totalSeconds / (3600 * 24));\n const hours = Math.floor((totalSeconds - days * 3600 * 24) / 3600);\n const minutes = Math.floor(\n (totalSeconds - days * 3600 * 24 - hours * 3600) / 60\n );\n const seconds = totalSeconds - days * 3600 * 24 - hours * 3600 - minutes * 60;\n\n let result = '';\n if (days) {\n result += pad(days) + 'd:';\n }\n if (hours) {\n result += pad(hours) + 'h:';\n }\n result += pad(minutes) + 'm:' + pad(seconds) + 's';\n return result;\n}\n\nfunction pad(value: number): string {\n if (value === 0) {\n return '00';\n }\n return value >= 10 ? value.toString() : '0' + value;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n BASE_ENDPOINT,\n EXCHANGE_DEBUG_TOKEN_METHOD,\n EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD,\n EXCHANGE_RECAPTCHA_TOKEN_METHOD\n} from './constants';\nimport { FirebaseApp } from '@firebase/app';\nimport { ERROR_FACTORY, AppCheckError } from './errors';\nimport { Provider } from '@firebase/component';\nimport { AppCheckTokenInternal } from './types';\n\n/**\n * Response JSON returned from AppCheck server endpoint.\n */\ninterface AppCheckResponse {\n token: string;\n // timeToLive\n ttl: string;\n}\n\ninterface AppCheckRequest {\n url: string;\n body: { [key: string]: string };\n}\n\nexport async function exchangeToken(\n { url, body }: AppCheckRequest,\n heartbeatServiceProvider: Provider<'heartbeat'>\n): Promise<AppCheckTokenInternal> {\n const headers: HeadersInit = {\n 'Content-Type': 'application/json'\n };\n // If heartbeat service exists, add heartbeat header string to the header.\n const heartbeatService = heartbeatServiceProvider.getImmediate({\n optional: true\n });\n if (heartbeatService) {\n const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader();\n if (heartbeatsHeader) {\n headers['X-Firebase-Client'] = heartbeatsHeader;\n }\n }\n const options: RequestInit = {\n method: 'POST',\n body: JSON.stringify(body),\n headers\n };\n let response;\n try {\n response = await fetch(url, options);\n } catch (originalError) {\n throw ERROR_FACTORY.create(AppCheckError.FETCH_NETWORK_ERROR, {\n originalErrorMessage: (originalError as Error)?.message\n });\n }\n\n if (response.status !== 200) {\n throw ERROR_FACTORY.create(AppCheckError.FETCH_STATUS_ERROR, {\n httpStatus: response.status\n });\n }\n\n let responseBody: AppCheckResponse;\n try {\n // JSON parsing throws SyntaxError if the response body isn't a JSON string.\n responseBody = await response.json();\n } catch (originalError) {\n throw ERROR_FACTORY.create(AppCheckError.FETCH_PARSE_ERROR, {\n originalErrorMessage: (originalError as Error)?.message\n });\n }\n\n // Protobuf duration format.\n // https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Duration\n const match = responseBody.ttl.match(/^([\\d.]+)(s)$/);\n if (!match || !match[2] || isNaN(Number(match[1]))) {\n throw ERROR_FACTORY.create(AppCheckError.FETCH_PARSE_ERROR, {\n originalErrorMessage:\n `ttl field (timeToLive) is not in standard Protobuf Duration ` +\n `format: ${responseBody.ttl}`\n });\n }\n const timeToLiveAsNumber = Number(match[1]) * 1000;\n\n const now = Date.now();\n return {\n token: responseBody.token,\n expireTimeMillis: now + timeToLiveAsNumber,\n issuedAtTimeMillis: now\n };\n}\n\nexport function getExchangeRecaptchaV3TokenRequest(\n app: FirebaseApp,\n reCAPTCHAToken: string\n): AppCheckRequest {\n const { projectId, appId, apiKey } = app.options;\n\n return {\n url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_RECAPTCHA_TOKEN_METHOD}?key=${apiKey}`,\n body: {\n 'recaptcha_v3_token': reCAPTCHAToken\n }\n };\n}\n\nexport function getExchangeRecaptchaEnterpriseTokenRequest(\n app: FirebaseApp,\n reCAPTCHAToken: string\n): AppCheckRequest {\n const { projectId, appId, apiKey } = app.options;\n\n return {\n url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD}?key=${apiKey}`,\n body: {\n 'recaptcha_enterprise_token': reCAPTCHAToken\n }\n };\n}\n\nexport function getExchangeDebugTokenRequest(\n app: FirebaseApp,\n debugToken: string\n): AppCheckRequest {\n const { projectId, appId, apiKey } = app.options;\n\n return {\n url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_DEBUG_TOKEN_METHOD}?key=${apiKey}`,\n body: {\n // eslint-disable-next-line\n debug_token: debugToken\n }\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp } from '@firebase/app';\nimport { ERROR_FACTORY, AppCheckError } from './errors';\nimport { AppCheckTokenInternal } from './types';\nconst DB_NAME = 'firebase-app-check-database';\nconst DB_VERSION = 1;\nconst STORE_NAME = 'firebase-app-check-store';\nconst DEBUG_TOKEN_KEY = 'debug-token';\n\nlet dbPromise: Promise<IDBDatabase> | null = null;\nfunction getDBPromise(): Promise<IDBDatabase> {\n if (dbPromise) {\n return dbPromise;\n }\n\n dbPromise = new Promise((resolve, reject) => {\n try {\n const request = indexedDB.open(DB_NAME, DB_VERSION);\n\n request.onsuccess = event => {\n resolve((event.target as IDBOpenDBRequest).result);\n };\n\n request.onerror = event => {\n reject(\n ERROR_FACTORY.create(AppCheckError.STORAGE_OPEN, {\n originalErrorMessage: (event.target as IDBRequest).error?.message\n })\n );\n };\n\n request.onupgradeneeded = event => {\n const db = (event.target as IDBOpenDBRequest).result;\n\n // We don't use 'break' in this switch statement, the fall-through\n // behavior is what we want, because if there are multiple versions between\n // the old version and the current version, we want ALL the migrations\n // that correspond to those versions to run, not only the last one.\n // eslint-disable-next-line default-case\n switch (event.oldVersion) {\n case 0:\n db.createObjectStore(STORE_NAME, {\n keyPath: 'compositeKey'\n });\n }\n };\n } catch (e) {\n reject(\n ERROR_FACTORY.create(AppCheckError.STORAGE_OPEN, {\n originalErrorMessage: (e as Error)?.message\n })\n );\n }\n });\n\n return dbPromise;\n}\n\nexport function readTokenFromIndexedDB(\n app: FirebaseApp\n): Promise<AppCheckTokenInternal | undefined> {\n return read(computeKey(app)) as Promise<AppCheckTokenInternal | undefined>;\n}\n\nexport function writeTokenToIndexedDB(\n app: FirebaseApp,\n token?: AppCheckTokenInternal\n): Promise<void> {\n return write(computeKey(app), token);\n}\n\nexport function writeDebugTokenToIndexedDB(token: string): Promise<void> {\n return write(DEBUG_TOKEN_KEY, token);\n}\n\nexport function readDebugTokenFromIndexedDB(): Promise<string | undefined> {\n return read(DEBUG_TOKEN_KEY) as Promise<string | undefined>;\n}\n\nasync function write(key: string, value: unknown): Promise<void> {\n const db = await getDBPromise();\n\n const transaction = db.transaction(STORE_NAME, 'readwrite');\n const store = transaction.objectStore(STORE_NAME);\n const request = store.put({\n compositeKey: key,\n value\n });\n\n return new Promise((resolve, reject) => {\n request.onsuccess = _event => {\n resolve();\n };\n\n transaction.onerror = event => {\n reject(\n ERROR_FACTORY.create(AppCheckError.STORAGE_WRITE, {\n originalErrorMessage: (event.target as IDBRequest).error?.message\n })\n );\n };\n });\n}\n\nasync function read(key: string): Promise<unknown> {\n const db = await getDBPromise();\n\n const transaction = db.transaction(STORE_NAME, 'readonly');\n const store = transaction.objectStore(STORE_NAME);\n const request = store.get(key);\n\n return new Promise((resolve, reject) => {\n request.onsuccess = event => {\n const result = (event.target as IDBRequest).result;\n\n if (result) {\n resolve(result.value);\n } else {\n resolve(undefined);\n }\n };\n\n transaction.onerror = event => {\n reject(\n ERROR_FACTORY.create(AppCheckError.STORAGE_GET, {\n originalErrorMessage: (event.target as IDBRequest).error?.message\n })\n );\n };\n });\n}\n\nfunction computeKey(app: FirebaseApp): string {\n return `${app.options.appId}-${app.name}`;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from '@firebase/logger';\n\nexport const logger = new Logger('@firebase/app-check');\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp } from '@firebase/app';\nimport { isIndexedDBAvailable } from '@firebase/util';\nimport {\n readDebugTokenFromIndexedDB,\n readTokenFromIndexedDB,\n writeDebugTokenToIndexedDB,\n writeTokenToIndexedDB\n} from './indexeddb';\nimport { logger } from './logger';\nimport { AppCheckTokenInternal } from './types';\n\n/**\n * Always resolves. In case of an error reading from indexeddb, resolve with undefined\n */\nexport async function readTokenFromStorage(\n app: FirebaseApp\n): Promise<AppCheckTokenInternal | undefined> {\n if (isIndexedDBAvailable()) {\n let token = undefined;\n try {\n token = await readTokenFromIndexedDB(app);\n } catch (e) {\n // swallow the error and return undefined\n logger.warn(`Failed to read token from IndexedDB. Error: ${e}`);\n }\n return token;\n }\n\n return undefined;\n}\n\n/**\n * Always resolves. In case of an error writing to indexeddb, print a warning and resolve the promise\n */\nexport function writeTokenToStorage(\n app: FirebaseApp,\n token?: AppCheckTokenInternal\n): Promise<void> {\n if (isIndexedDBAvailable()) {\n return writeTokenToIndexedDB(app, token).catch(e => {\n // swallow the error and resolve the promise\n logger.warn(`Failed to write token to IndexedDB. Error: ${e}`);\n });\n }\n\n return Promise.resolve();\n}\n\nexport async function readOrCreateDebugTokenFromStorage(): Promise<string> {\n /**\n * Theoretically race condition can happen if we read, then write in 2 separate transactions.\n * But it won't happen here, because this function will be called exactly once.\n */\n let existingDebugToken: string | undefined = undefined;\n try {\n existingDebugToken = await readDebugTokenFromIndexedDB();\n } catch (_e) {\n // failed to read from indexeddb. We assume there is no existing debug token, and generate a new one.\n }\n\n if (!existingDebugToken) {\n // create a new debug token\n // This function is only available in secure contexts. See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts\n const newToken = crypto.randomUUID();\n // We don't need to block on writing to indexeddb\n // In case persistence failed, a new debug token will be generated every time the page is refreshed.\n // It renders the debug token useless because you have to manually register(whitelist) the new token in the firebase console again and again.\n // If you see this error trying to use debug token, it probably means you are using a browser that doesn't support indexeddb.\n // You should switch to a different browser that supports indexeddb\n writeDebugTokenToIndexedDB(newToken).catch(e =>\n logger.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)\n );\n return newToken;\n } else {\n return existingDebugToken;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getDebugState } from './state';\nimport { readOrCreateDebugTokenFromStorage } from './storage';\nimport { Deferred, getGlobal } from '@firebase/util';\n\ndeclare global {\n // var must be used for global scopes\n // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#type-checking-for-globalthis\n // eslint-disable-next-line no-var\n var FIREBASE_APPCHECK_DEBUG_TOKEN: boolean | string | undefined;\n}\n\nexport function isDebugMode(): boolean {\n const debugState = getDebugState();\n return debugState.enabled;\n}\n\nexport async function getDebugToken(): Promise<string> {\n const state = getDebugState();\n\n if (state.enabled && state.token) {\n return state.token.promise;\n } else {\n // should not happen!\n throw Error(`\n Can't get debug token in production mode.\n `);\n }\n}\n\nexport function initializeDebugMode(): void {\n const globals = getGlobal();\n const debugState = getDebugState();\n // Set to true if this function has been called, whether or not\n // it enabled debug mode.\n debugState.initialized = true;\n\n if (\n typeof globals.FIREBASE_APPCHECK_DEBUG_TOKEN !== 'string' &&\n globals.FIREBASE_APPCHECK_DEBUG_TOKEN !== true\n ) {\n return;\n }\n\n debugState.enabled = true;\n const deferredToken = new Deferred<string>();\n debugState.token = deferredToken;\n\n if (typeof globals.FIREBASE_APPCHECK_DEBUG_TOKEN === 'string') {\n deferredToken.resolve(globals.FIREBASE_APPCHECK_DEBUG_TOKEN);\n } else {\n deferredToken.resolve(readOrCreateDebugTokenFromStorage());\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp } from '@firebase/app';\nimport {\n AppCheckTokenResult,\n AppCheckTokenInternal,\n AppCheckTokenObserver,\n ListenerType\n} from './types';\nimport { AppCheckTokenListener } from './public-types';\nimport { getStateReference } from './state';\nimport { TOKEN_REFRESH_TIME } from './constants';\nimport { Refresher } from './proactive-refresh';\nimport { ensureActivated } from './util';\nimport { exchangeToken, getExchangeDebugTokenRequest } from './client';\nimport { writeTokenToStorage } from './storage';\nimport { getDebugToken, isDebugMode } from './debug';\nimport { base64, FirebaseError } from '@firebase/util';\nimport { logger } from './logger';\nimport { AppCheckService } from './factory';\nimport { AppCheckError } from './errors';\n\n// Initial hardcoded value agreed upon across platforms for initial launch.\n// Format left open for possible dynamic error values and other fields in the future.\nexport const defaultTokenErrorData = { error: 'UNKNOWN_ERROR' };\n\n/**\n * Stringify and base64 encode token error data.\n *\n * @param tokenError Error data, currently hardcoded.\n */\nexport function formatDummyToken(\n tokenErrorData: Record<string, string>\n): string {\n return base64.encodeString(\n JSON.stringify(tokenErrorData),\n /* webSafe= */ false\n );\n}\n\n/**\n * This function always resolves.\n * The result will contain an error field if there is any error.\n * In case there is an error, the token field in the result will be populated with a dummy value\n */\nexport async function getToken(\n appCheck: AppCheckService,\n forceRefresh = false,\n shouldLogErrors = false\n): Promise<AppCheckTokenResult> {\n const app = appCheck.app;\n ensureActivated(app);\n\n const state = getStateReference(app);\n\n /**\n * First check if there is a token in memory from a previous `getToken()` call.\n */\n let token: AppCheckTokenInternal | undefined = state.token;\n let error: Error | undefined = undefined;\n\n /**\n * If an invalid token was found in memory, clear token from\n * memory and unset the local variable `token`.\n */\n if (token && !isValid(token)) {\n state.token = undefined;\n token = undefined;\n }\n\n /**\n * If there is no valid token in memory, try to load token from indexedDB.\n */\n if (!token) {\n // cachedTokenPromise contains the token found in IndexedDB or undefined if not found.\n const cachedToken = await state.cachedTokenPromise;\n if (cachedToken) {\n if (isValid(cachedToken)) {\n token = cachedToken;\n } else {\n // If there was an invalid token in the indexedDB cache, clear it.\n await writeTokenToStorage(app, undefined);\n }\n }\n }\n\n // Return the cached token (from either memory or indexedDB) if it's valid\n if (!forceRefresh && token && isValid(token)) {\n return {\n token: token.token\n };\n }\n\n // Only set to true if this `getToken()` call is making the actual\n // REST call to the exchange endpoint, versus waiting for an already\n // in-flight call (see debug and regular exchange endpoint paths below)\n let shouldCallListeners = false;\n\n /**\n * DEBUG MODE\n * If debug mode is set, and there is no cached token, fetch a new App\n * Check token using the debug token, and return it directly.\n */\n if (isDebugMode()) {\n try {\n // Avoid making another call to the exchange endpoint if one is in flight.\n if (!state.exchangeTokenPromise) {\n state.exchangeTokenPromise = exchangeToken(\n getExchangeDebugTokenRequest(app, await getDebugToken()),\n appCheck.heartbeatServiceProvider\n ).finally(() => {\n // Clear promise when settled - either resolved or rejected.\n state.exchangeTokenPromise = undefined;\n });\n shouldCallListeners = true;\n }\n const tokenFromDebugExchange: AppCheckTokenInternal =\n await state.exchangeTokenPromise;\n // Write debug token to indexedDB.\n await writeTokenToStorage(app, tokenFromDebugExchange);\n // Write debug token to state.\n state.token = tokenFromDebugExchange;\n return { token: tokenFromDebugExchange.token };\n } catch (e) {\n if (\n (e as FirebaseError).code === `appCheck/${AppCheckError.THROTTLED}` ||\n (e as FirebaseError).code ===\n `appCheck/${AppCheckError.INITIAL_THROTTLE}`\n ) {\n // Warn if throttled, but do not treat it as an error.\n logger.warn((e as FirebaseError).message);\n } else if (shouldLogErrors) {\n logger.error(e);\n }\n // Return dummy token and error\n return makeDummyTokenResult(e as FirebaseError);\n }\n }\n\n /**\n * There are no valid tokens in memory or indexedDB and we are not in\n * debug mode.\n * Request a new token from the exchange endpoint.\n */\n try {\n // Avoid making another call to the exchange endpoint if one is in flight.\n if (!state.exchangeTokenPromise) {\n // state.provider is populated in initializeAppCheck()\n // ensureActivated() at the top of this function checks that\n // initializeAppCheck() has been called.\n state.exchangeTokenPromise = state.provider!.getToken().finally(() => {\n // Clear promise when settled - either resolved or rejected.\n state.exchangeTokenPromise = undefined;\n });\n shouldCallListeners = true;\n }\n token = await getStateReference(app).exchangeTokenPromise;\n } catch (e) {\n if (\n (e as FirebaseError).code === `appCheck/${AppCheckError.THROTTLED}` ||\n (e as FirebaseError).code === `appCheck/${AppCheckError.INITIAL_THROTTLE}`\n ) {\n // Warn if throttled, but do not treat it as an error.\n logger.warn((e as FirebaseError).message);\n } else if (shouldLogErrors) {\n logger.error(e);\n }\n // Always save error to be added to dummy token.\n error = e as FirebaseError;\n }\n\n let interopTokenResult: AppCheckTokenResult | undefined;\n if (!token) {\n // If token is undefined, there must be an error.\n // Return a dummy token along with the error.\n interopTokenResult = makeDummyTokenResult(error!);\n } else if (error) {\n if (isValid(token)) {\n // It's also possible a valid token exists, but there's also an error.\n // (Such as if the token is almost expired, tries to refresh, and\n // the exchange request fails.)\n // We add a special error property here so that the refresher will\n // count this as a failed attempt and use the backoff instead of\n // retrying repeatedly with no delay, but any 3P listeners will not\n // be hindered in getting the still-valid token.\n interopTokenResult = {\n token: token.token,\n internalError: error\n };\n } else {\n // No invalid tokens should make it to this step. Memory and cached tokens\n // are checked. Other tokens are from fresh exchanges. But just in case.\n interopTokenResult = makeDummyTokenResult(error!);\n }\n } else {\n interopTokenResult = {\n token: token.token\n };\n // write the new token to the memory state as well as the persistent storage.\n // Only do it if we got a valid new token\n state.token = token;\n await writeTokenToStorage(app, token);\n }\n\n if (shouldCallListeners) {\n notifyTokenListeners(app, interopTokenResult);\n }\n return interopTokenResult;\n}\n\n/**\n * Internal API for limited use tokens. Skips all FAC state and simply calls\n * the underlying provider.\n */\nexport async function getLimitedUseToken(\n appCheck: AppCheckService\n): Promise<AppCheckTokenResult> {\n const app = appCheck.app;\n ensureActivated(app);\n\n const { provider } = getStateReference(app);\n\n if (isDebugMode()) {\n const debugToken = await getDebugToken();\n const { token } = await exchangeToken(\n getExchangeDebugTokenRequest(app, debugToken),\n appCheck.heartbeatServiceProvider\n );\n return { token };\n } else {\n // provider is definitely valid since we ensure AppCheck was activated\n const { token } = await provider!.getToken();\n return { token };\n }\n}\n\nexport function addTokenListener(\n appCheck: AppCheckService,\n type: ListenerType,\n listener: AppCheckTokenListener,\n onError?: (error: Error) => void\n): void {\n const { app } = appCheck;\n const state = getStateReference(app);\n const tokenObserver: AppCheckTokenObserver = {\n next: listener,\n error: onError,\n type\n };\n state.tokenObservers = [...state.tokenObservers, tokenObserver];\n\n // Invoke the listener async immediately if there is a valid token\n // in memory.\n if (state.token && isValid(state.token)) {\n const validToken = state.token;\n Promise.resolve()\n .then(() => {\n listener({ token: validToken.token });\n initTokenRefresher(appCheck);\n })\n .catch(() => {\n /* we don't care about exceptions thrown in listeners */\n });\n }\n\n /**\n * Wait for any cached token promise to resolve before starting the token\n * refresher. The refresher checks to see if there is an existing token\n * in state and calls the exchange endpoint if not. We should first let the\n * IndexedDB check have a chance to populate state if it can.\n *\n * Listener call isn't needed here because cachedTokenPromise will call any\n * listeners that exist when it resolves.\n */\n\n // state.cachedTokenPromise is always populated in `activate()`.\n void state.cachedTokenPromise!.then(() => initTokenRefresher(appCheck));\n}\n\nexport function removeTokenListener(\n app: FirebaseApp,\n listener: AppCheckTokenListener\n): void {\n const state = getStateReference(app);\n\n const newObservers = state.tokenObservers.filter(\n tokenObserver => tokenObserver.next !== listener\n );\n if (\n newObservers.length === 0 &&\n state.tokenRefresher &&\n state.tokenRefresher.isRunning()\n ) {\n state.tokenRefresher.stop();\n }\n\n state.tokenObservers = newObservers;\n}\n\n/**\n * Logic to create and start refresher as needed.\n */\nfunction initTokenRefresher(appCheck: AppCheckService): void {\n const { app } = appCheck;\n const state = getStateReference(app);\n // Create the refresher but don't start it if `isTokenAutoRefreshEnabled`\n // is not true.\n let refresher: Refresher | undefined = state.tokenRefresher;\n if (!refresher) {\n refresher = createTokenRefresher(appCheck);\n state.tokenRefresher = refresher;\n }\n if (!refresher.isRunning() && state.isTokenAutoRefreshEnabled) {\n refresher.start();\n }\n}\n\nfunction createTokenRefresher(appCheck: AppCheckService): Refresher {\n const { app } = appCheck;\n return new Refresher(\n // Keep in mind when this fails for any reason other than the ones\n // for which we should retry, it will effectively stop the proactive refresh.\n async () => {\n const state = getStateReference(app);\n // If there is no token, we will try to load it from storage and use it\n // If there is a token, we force refresh it because we know it's going to expire soon\n let result;\n if (!state.token) {\n result = await getToken(appCheck);\n } else {\n result = await getToken(appCheck, true);\n }\n\n /**\n * getToken() always resolves. In case the result has an error field defined, it means\n * the operation failed, and we should retry.\n */\n if (result.error) {\n throw result.error;\n }\n /**\n * A special `internalError` field reflects that there was an error\n * getting a new token from the exchange endpoint, but there's still a\n * previous token that's valid for now and this should be passed to 2P/3P\n * requests for a token. But we want this callback (`this.operation` in\n * `Refresher`) to throw in order to kick off the Refresher's retry\n * backoff. (Setting `hasSucceeded` to false.)\n */\n if (result.internalError) {\n throw result.internalError;\n }\n },\n () => {\n return true;\n },\n () => {\n const state = getStateReference(app);\n\n if (state.token) {\n // issuedAtTime + (50% * total TTL) + 5 minutes\n let nextRefreshTimeMillis =\n state.token.issuedAtTimeMillis +\n (state.token.expireTimeMillis - state.token.issuedAtTimeMillis) *\n 0.5 +\n 5 * 60 * 1000;\n // Do not allow refresh time to be past (expireTime - 5 minutes)\n const latestAllowableRefresh =\n state.token.expireTimeMillis - 5 * 60 * 1000;\n nextRefreshTimeMillis = Math.min(\n nextRefreshTimeMillis,\n latestAllowableRefresh\n );\n return Math.max(0, nextRefreshTimeMillis - Date.now());\n } else {\n return 0;\n }\n },\n TOKEN_REFRESH_TIME.RETRIAL_MIN_WAIT,\n TOKEN_REFRESH_TIME.RETRIAL_MAX_WAIT\n );\n}\n\nexport function notifyTokenListeners(\n app: FirebaseApp,\n token: AppCheckTokenResult\n): void {\n const observers = getStateReference(app).tokenObservers;\n\n for (const observer of observers) {\n try {\n if (observer.type === ListenerType.EXTERNAL && token.error != null) {\n // If this listener was added by a 3P call, send any token error to\n // the supplied error handler. A 3P observer always has an error\n // handler.\n observer.error!(token.error);\n } else {\n // If the token has no error field, always return the token.\n // If this is a 2P listener, return the token, whether or not it\n // has an error field.\n observer.next(token);\n }\n } catch (e) {\n // Errors in the listener function itself are always ignored.\n }\n }\n}\n\nexport function isValid(token: AppCheckTokenInternal): boolean {\n return token.expireTimeMillis - Date.now() > 0;\n}\n\nfunction makeDummyTokenResult(error: Error): AppCheckTokenResult {\n return {\n token: formatDummyToken(defaultTokenErrorData),\n error\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AppCheck } from './public-types';\nimport { FirebaseApp, _FirebaseService } from '@firebase/app';\nimport { FirebaseAppCheckInternal, ListenerType } from './types';\nimport {\n getToken,\n getLimitedUseToken,\n addTokenListener,\n removeTokenListener\n} from './internal-api';\nimport { Provider } from '@firebase/component';\nimport { getStateReference } from './state';\n\n/**\n * AppCheck Service class.\n */\nexport class AppCheckService implements AppCheck, _FirebaseService {\n constructor(\n public app: FirebaseApp,\n public heartbeatServiceProvider: Provider<'heartbeat'>\n ) {}\n _delete(): Promise<void> {\n const { tokenObservers } = getStateReference(this.app);\n for (const tokenObserver of tokenObservers) {\n removeTokenListener(this.app, tokenObserver.next);\n }\n return Promise.resolve();\n }\n}\n\nexport function factory(\n app: FirebaseApp,\n heartbeatServiceProvider: Provider<'heartbeat'>\n): AppCheckService {\n return new AppCheckService(app, heartbeatServiceProvider);\n}\n\nexport function internalFactory(\n appCheck: AppCheckService\n): FirebaseAppCheckInternal {\n return {\n getToken: forceRefresh => getToken(appCheck, forceRefresh),\n getLimitedUseToken: () => getLimitedUseToken(appCheck),\n addTokenListener: listener =>\n addTokenListener(appCheck, ListenerType.INTERNAL, listener),\n removeTokenListener: listener => removeTokenListener(appCheck.app, listener)\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp } from '@firebase/app';\nimport { getStateReference } from './state';\nimport { Deferred } from '@firebase/util';\nimport { getRecaptcha, ensureActivated } from './util';\n\nexport const RECAPTCHA_URL = 'https://www.google.com/recaptcha/api.js';\nexport const RECAPTCHA_ENTERPRISE_URL =\n 'https://www.google.com/recaptcha/enterprise.js';\n\nexport function initializeV3(\n app: FirebaseApp,\n siteKey: string\n): Promise<GreCAPTCHA> {\n const initialized = new Deferred<GreCAPTCHA>();\n\n const state = getStateReference(app);\n state.reCAPTCHAState = { initialized };\n\n const divId = makeDiv(app);\n\n const grecaptcha = getRecaptcha(false);\n if (!grecaptcha) {\n loadReCAPTCHAV3Script(() => {\n const grecaptcha = getRecaptcha(false);\n\n if (!grecaptcha) {\n // it shouldn't happen.\n throw new Error('no recaptcha');\n }\n queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);\n });\n } else {\n queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);\n }\n return initialized.promise;\n}\nexport function initializeEnterprise(\n app: FirebaseApp,\n siteKey: string\n): Promise<GreCAPTCHA> {\n const initialized = new Deferred<GreCAPTCHA>();\n\n const state = getStateReference(app);\n state.reCAPTCHAState = { initialized };\n\n const divId = makeDiv(app);\n\n const grecaptcha = getRecaptcha(true);\n if (!grecaptcha) {\n loadReCAPTCHAEnterpriseScript(() => {\n const grecaptcha = getRecaptcha(true);\n\n if (!grecaptcha) {\n // it shouldn't happen.\n throw new Error('no recaptcha');\n }\n queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);\n });\n } else {\n queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);\n }\n return initialized.promise;\n}\n\n/**\n * Add listener to render the widget and resolve the promise when\n * the grecaptcha.ready() event fires.\n */\nfunction queueWidgetRender(\n app: FirebaseApp,\n siteKey: string,\n grecaptcha: GreCAPTCHA,\n container: string,\n initialized: Deferred<GreCAPTCHA>\n): void {\n grecaptcha.ready(() => {\n // Invisible widgets allow us to set a different siteKey for each widget,\n // so we use them to support multiple apps\n renderInvisibleWidget(app, siteKey, grecaptcha, container);\n initialized.resolve(grecaptcha);\n });\n}\n\n/**\n * Add invisible div to page.\n */\nfunction makeDiv(app: FirebaseApp): string {\n const divId = `fire_app_check_${app.name}`;\n const invisibleDiv = document.createElement('div');\n invisibleDiv.id = divId;\n invisibleDiv.style.display = 'none';\n\n document.body.appendChild(invisibleDiv);\n return divId;\n}\n\nexport async function getToken(app: FirebaseApp): Promise<string> {\n ensureActivated(app);\n\n // ensureActivated() guarantees that reCAPTCHAState is set\n const reCAPTCHAState = getStateReference(app).reCAPTCHAState!;\n const recaptcha = await reCAPTCHAState.initialized.promise;\n\n return new Promise((resolve, _reject) => {\n // Updated after initialization is complete.\n const reCAPTCHAState = getStateReference(app).reCAPTCHAState!;\n recaptcha.ready(() => {\n resolve(\n // widgetId is guaranteed to be available if reCAPTCHAState.initialized.promise resolved.\n recaptcha.execute(reCAPTCHAState.widgetId!, {\n action: 'fire_app_check'\n })\n );\n });\n });\n}\n\n/**\n *\n * @param app\n * @param container - Id of a HTML element.\n */\nfunction renderInvisibleWidget(\n app: FirebaseApp,\n siteKey: string,\n grecaptcha: GreCAPTCHA,\n container: string\n): void {\n const widgetId = grecaptcha.render(container, {\n sitekey: siteKey,\n size: 'invisible',\n // Success callback - set state\n callback: () => {\n getStateReference(app).reCAPTCHAState!.succeeded = true;\n },\n // Failure callback - set state\n 'error-callback': () => {\n getStateReference(app).reCAPTCHAState!.succeeded = false;\n }\n });\n\n const state = getStateReference(app);\n\n state.reCAPTCHAState = {\n ...state.reCAPTCHAState!, // state.reCAPTCHAState is set in the initialize()\n widgetId\n };\n}\n\nfunction loadReCAPTCHAV3Script(onload: () => void): void {\n const script = document.createElement('script');\n script.src = RECAPTCHA_URL;\n script.onload = onload;\n document.head.appendChild(script);\n}\n\nfunction loadReCAPTCHAEnterpriseScript(onload: () => void): void {\n const script = document.createElement('script');\n script.src = RECAPTCHA_ENTERPRISE_URL;\n script.onload = onload;\n document.head.appendChild(script);\n}\n\ndeclare global {\n interface Window {\n grecaptcha: GreCAPTCHATopLevel | undefined;\n }\n}\n\nexport interface GreCAPTCHATopLevel extends GreCAPTCHA {\n enterprise: GreCAPTCHA;\n}\n\nexport interface GreCAPTCHA {\n ready: (callback: () => void) => void;\n execute: (siteKey: string, options: { action: string }) => Promise<string>;\n render: (\n container: string | HTMLElement,\n parameters: GreCAPTCHARenderOption\n ) => string;\n}\n\nexport interface GreCAPTCHARenderOption {\n sitekey: string;\n size: 'invisible';\n callback: () => void;\n 'error-callback': () => void;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp, _getProvider } from '@firebase/app';\nimport { Provider } from '@firebase/component';\nimport {\n FirebaseError,\n issuedAtTime,\n calculateBackoffMillis\n} from '@firebase/util';\nimport {\n exchangeToken,\n getExchangeRecaptchaEnterpriseTokenRequest,\n getExchangeRecaptchaV3TokenRequest\n} from './client';\nimport { ONE_DAY } from './constants';\nimport { AppCheckError, ERROR_FACTORY } from './errors';\nimport { CustomProviderOptions } from './public-types';\nimport {\n getToken as getReCAPTCHAToken,\n initializeV3 as initializeRecaptchaV3,\n initializeEnterprise as initializeRecaptchaEnterprise\n} from './recaptcha';\nimport { getStateReference } from './state';\nimport { AppCheckProvider, AppCheckTokenInternal, ThrottleData } from './types';\nimport { getDurationString } from './util';\n\n/**\n * App Check provider that can obtain a reCAPTCHA V3 token and exchange it\n * for an App Check token.\n *\n * @public\n */\nexport class ReCaptchaV3Provider implements AppCheckProvider {\n private _app?: FirebaseApp;\n private _heartbeatServiceProvider?: Provider<'heartbeat'>;\n /**\n * Throttle requests on certain error codes to prevent too many retries\n * in a short time.\n */\n private _throttleData: ThrottleData | null = null;\n /**\n * Create a ReCaptchaV3Provider instance.\n * @param siteKey - ReCAPTCHA V3 siteKey.\n */\n constructor(private _siteKey: string) {}\n\n /**\n * Returns an App Check token.\n * @internal\n */\n async getToken(): Promise<AppCheckTokenInternal> {\n throwIfThrottled(this._throttleData);\n\n // Top-level `getToken()` has already checked that App Check is initialized\n // and therefore this._app and this._heartbeatServiceProvider are available.\n const attestedClaimsToken = await getReCAPTCHAToken(this._app!).catch(\n _e => {\n // reCaptcha.execute() throws null which is not very descriptive.\n throw ERROR_FACTORY.create(AppCheckError.RECAPTCHA_ERROR);\n }\n );\n // Check if a failure state was set by the recaptcha \"error-callback\".\n if (!getStateReference(this._app!).reCAPTCHAState?.succeeded) {\n throw ERROR_FACTORY.create(AppCheckError.RECAPTCHA_ERROR);\n }\n let result;\n try {\n result = await exchangeToken(\n getExchangeRecaptchaV3TokenRequest(this._app!, attestedClaimsToken),\n this._heartbeatServiceProvider!\n );\n } catch (e) {\n if (\n (e as FirebaseError).code?.includes(AppCheckError.FETCH_STATUS_ERROR)\n ) {\n this._throttleData = setBackoff(\n Number((e as FirebaseError).customData?.httpStatus),\n this._throttleData\n );\n throw ERROR_FACTORY.create(AppCheckError.INITIAL_THROTTLE, {\n time: getDurationString(\n this._throttleData.allowRequestsAfter - Date.now()\n ),\n httpStatus: this._throttleData.httpStatus\n });\n } else {\n throw e;\n }\n }\n // If successful, clear throttle data.\n this._throttleData = null;\n return result;\n }\n\n /**\n * @internal\n */\n initialize(app: FirebaseApp): void {\n this._app = app;\n this._heartbeatServiceProvider = _getProvider(app, 'heartbeat');\n initializeRecaptchaV3(app, this._siteKey).catch(() => {\n /* we don't care about the initialization result */\n });\n }\n\n /**\n * @internal\n */\n isEqual(otherProvider: unknown): boolean {\n if (otherProvider instanceof ReCaptchaV3Provider) {\n return this._siteKey === otherProvider._siteKey;\n } else {\n return false;\n }\n }\n}\n\n/**\n * App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it\n * for an App Check token.\n *\n * @public\n */\nexport class ReCaptchaEnterpriseProvider implements AppCheckProvider {\n private _app?: FirebaseApp;\n private _heartbeatServiceProvider?: Provider<'heartbeat'>;\n /**\n * Throttle requests on certain error codes to prevent too many retries\n * in a short time.\n */\n private _throttleData: ThrottleData | null = null;\n /**\n * Create a ReCaptchaEnterpriseProvider instance.\n * @param siteKey - reCAPTCHA Enterprise score-based site key.\n */\n constructor(private _siteKey: string) {}\n\n /**\n * Returns an App Check token.\n * @internal\n */\n async getToken(): Promise<AppCheckTokenInternal> {\n throwIfThrottled(this._throttleData);\n // Top-level `getToken()` has already checked that App Check is initialized\n // and therefore this._app and this._heartbeatServiceProvider are available.\n const attestedClaimsToken = await getReCAPTCHAToken(this._app!).catch(\n _e => {\n // reCaptcha.execute() throws null which is not very descriptive.\n throw ERROR_FACTORY.create(AppCheckError.RECAPTCHA_ERROR);\n }\n );\n // Check if a failure state was set by the recaptcha \"error-callback\".\n if (!getStateReference(this._app!).reCAPTCHAState?.succeeded) {\n throw ERROR_FACTORY.create(AppCheckError.RECAPTCHA_ERROR);\n }\n let result;\n try {\n result = await exchangeToken(\n getExchangeRecaptchaEnterpriseTokenRequest(\n this._app!,\n attestedClaimsToken\n ),\n this._heartbeatServiceProvider!\n );\n } catch (e) {\n if (\n (e as FirebaseError).code?.includes(AppCheckError.FETCH_STATUS_ERROR)\n ) {\n this._throttleData = setBackoff(\n Number((e as FirebaseError).customData?.httpStatus),\n this._throttleData\n );\n throw ERROR_FACTORY.create(AppCheckError.INITIAL_THROTTLE, {\n time: getDurationString(\n this._throttleData.allowRequestsAfter - Date.now()\n ),\n httpStatus: this._throttleData.httpStatus\n });\n } else {\n throw e;\n }\n }\n // If successful, clear throttle data.\n this._throttleData = null;\n return result;\n }\n\n /**\n * @internal\n */\n initialize(app: FirebaseApp): void {\n this._app = app;\n this._heartbeatServiceProvider = _getProvider(app, 'heartbeat');\n initializeRecaptchaEnterprise(app, this._siteKey).catch(() => {\n /* we don't care about the initialization result */\n });\n }\n\n /**\n * @internal\n */\n isEqual(otherProvider: unknown): boolean {\n if (otherProvider instanceof ReCaptchaEnterpriseProvider) {\n return this._siteKey === otherProvider._siteKey;\n } else {\n return false;\n }\n }\n}\n\n/**\n * Custom provider class.\n * @public\n */\nexport class CustomProvider implements AppCheckProvider {\n private _app?: FirebaseApp;\n\n constructor(private _customProviderOptions: CustomProviderOptions) {}\n\n /**\n * @internal\n */\n async getToken(): Promise<AppCheckTokenInternal> {\n // custom provider\n const customToken = await this._customProviderOptions.getToken();\n // Try to extract IAT from custom token, in case this token is not\n // being newly issued. JWT timestamps are in seconds since epoch.\n const issuedAtTimeSeconds = issuedAtTime(customToken.token);\n // Very basic validation, use current timestamp as IAT if JWT\n // has no `iat` field or value is out of bounds.\n const issuedAtTimeMillis =\n issuedAtTimeSeconds !== null &&\n issuedAtTimeSeconds < Date.now() &&\n issuedAtTimeSeconds > 0\n ? issuedAtTimeSeconds * 1000\n : Date.now();\n\n return { ...customToken, issuedAtTimeMillis };\n }\n\n /**\n * @internal\n */\n initialize(app: FirebaseApp): void {\n this._app = app;\n }\n\n /**\n * @internal\n */\n isEqual(otherProvider: unknown): boolean {\n if (otherProvider instanceof CustomProvider) {\n return (\n this._customProviderOptions.getToken.toString() ===\n otherProvider._customProviderOptions.getToken.toString()\n );\n } else {\n return false;\n }\n }\n}\n\n/**\n * Set throttle data to block requests until after a certain time\n * depending on the failed request's status code.\n * @param httpStatus - Status code of failed request.\n * @param throttleData - `ThrottleData` object containing previous throttle\n * data state.\n * @returns Data about current throttle state and expiration time.\n */\nfunction setBackoff(\n httpStatus: number,\n throttleData: ThrottleData | null\n): ThrottleData {\n /**\n * Block retries for 1 day for the following error codes:\n *\n * 404: Likely malformed URL.\n *\n * 403:\n * - Attestation failed\n * - Wrong API key\n * - Project deleted\n */\n if (httpStatus === 404 || httpStatus === 403) {\n return {\n backoffCount: 1,\n allowRequestsAfter: Date.now() + ONE_DAY,\n httpStatus\n };\n } else {\n /**\n * For all other error codes, the time when it is ok to retry again\n * is based on exponential backoff.\n */\n const backoffCount = throttleData ? throttleData.backoffCount : 0;\n const backoffMillis = calculateBackoffMillis(backoffCount, 1000, 2);\n return {\n backoffCount: backoffCount + 1,\n allowRequestsAfter: Date.now() + backoffMillis,\n httpStatus\n };\n }\n}\n\nfunction throwIfThrottled(throttleData: ThrottleData | null): void {\n if (throttleData) {\n if (Date.now() - throttleData.allowRequestsAfter <= 0) {\n // If before, throw.\n throw ERROR_FACTORY.create(AppCheckError.THROTTLED, {\n time: getDurationString(throttleData.allowRequestsAfter - Date.now()),\n httpStatus: throttleData.httpStatus\n });\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AppCheck,\n AppCheckOptions,\n AppCheckTokenResult,\n Unsubscribe,\n PartialObserver\n} from './public-types';\nimport { ERROR_FACTORY, AppCheckError } from './errors';\nimport {\n getStateReference,\n getDebugState,\n DEFAULT_STATE,\n setInitialState\n} from './state';\nimport { FirebaseApp, getApp, _getProvider } from '@firebase/app';\nimport { getModularInstance, ErrorFn, NextFn } from '@firebase/util';\nimport { AppCheckService } from './factory';\nimport { AppCheckProvider, ListenerType } from './types';\nimport {\n getToken as getTokenInternal,\n getLimitedUseToken as getLimitedUseTokenInternal,\n addTokenListener,\n removeTokenListener,\n isValid,\n notifyTokenListeners\n} from './internal-api';\nimport { readTokenFromStorage } from './storage';\nimport { getDebugToken, initializeDebugMode, isDebugMode } from './debug';\nimport { logger } from './logger';\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n 'app-check': AppCheckService;\n }\n}\n\nexport {\n ReCaptchaV3Provider,\n CustomProvider,\n ReCaptchaEnterpriseProvider\n} from './providers';\n\n/**\n * Activate App Check for the given app. Can be called only once per app.\n * @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for\n * @param options - App Check initialization options\n * @public\n */\nexport function initializeAppCheck(\n app: FirebaseApp = getApp(),\n options: AppCheckOptions\n): AppCheck {\n app = getModularInstance(app);\n const provider = _getProvider(app, 'app-check');\n\n // Ensure initializeDebugMode() is only called once.\n if (!getDebugState().initialized) {\n initializeDebugMode();\n }\n\n // Log a message containing the debug token when `initializeAppCheck()`\n // is called in debug mode.\n if (isDebugMode()) {\n // Do not block initialization to get the token for the message.\n void getDebugToken().then(token =>\n // Not using logger because I don't think we ever want this accidentally hidden.\n console.log(\n `App Check debug token: ${token}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`\n )\n );\n }\n\n if (provider.isInitialized()) {\n const existingInstance = provider.getImmediate();\n const initialOptions = provider.getOptions() as unknown as AppCheckOptions;\n if (\n initialOptions.isTokenAutoRefreshEnabled ===\n options.isTokenAutoRefreshEnabled &&\n initialOptions.provider.isEqual(options.provider)\n ) {\n return existingInstance;\n } else {\n throw ERROR_FACTORY.create(AppCheckError.ALREADY_INITIALIZED, {\n appName: app.name\n });\n }\n }\n\n const appCheck = provider.initialize({ options });\n _activate(app, options.provider, options.isTokenAutoRefreshEnabled);\n // If isTokenAutoRefreshEnabled is false, do not send any requests to the\n // exchange endpoint without an explicit call from the user either directly\n // or through another Firebase library (storage, functions, etc.)\n if (getStateReference(app).isTokenAutoRefreshEnabled) {\n // Adding a listener will start the refresher and fetch a token if needed.\n // This gets a token ready and prevents a delay when an internal library\n // requests the token.\n // Listener function does not need to do anything, its base functionality\n // of calling getToken() already fetches token and writes it to memory/storage.\n addTokenListener(appCheck, ListenerType.INTERNAL, () => {});\n }\n\n return appCheck;\n}\n\n/**\n * Activate App Check\n * @param app - Firebase app to activate App Check for.\n * @param provider - reCAPTCHA v3 provider or\n * custom token provider.\n * @param isTokenAutoRefreshEnabled - If true, the SDK automatically\n * refreshes App Check tokens as needed. If undefined, defaults to the\n * value of `app.automaticDataCollectionEnabled`, which defaults to\n * false and can be set in the app config.\n */\nfunction _activate(\n app: FirebaseApp,\n provider: AppCheckProvider,\n isTokenAutoRefreshEnabled: boolean = false\n): void {\n // Create an entry in the APP_CHECK_STATES map. Further changes should\n // directly mutate this object.\n const state = setInitialState(app, { ...DEFAULT_STATE });\n\n state.activated = true;\n state.provider = provider; // Read cached token from storage if it exists and store it in memory.\n state.cachedTokenPromise = readTokenFromStorage(app).then(cachedToken => {\n if (cachedToken && isValid(cachedToken)) {\n state.token = cachedToken;\n // notify all listeners with the cached token\n notifyTokenListeners(app, { token: cachedToken.token });\n }\n return cachedToken;\n });\n\n // Global `automaticDataCollectionEnabled` (defaults to true) and\n // `isTokenAutoRefreshEnabled` must both be true.\n state.isTokenAutoRefreshEnabled =\n isTokenAutoRefreshEnabled && app.automaticDataCollectionEnabled;\n\n if (!app.automaticDataCollectionEnabled && isTokenAutoRefreshEnabled) {\n logger.warn(\n '`isTokenAutoRefreshEnabled` is true but ' +\n '`automaticDataCollectionEnabled` was set to false during' +\n ' `initializeApp()`. This blocks automatic token refresh.'\n );\n }\n\n state.provider.initialize(app);\n}\n\n/**\n * Set whether App Check will automatically refresh tokens as needed.\n *\n * @param appCheckInstance - The App Check service instance.\n * @param isTokenAutoRefreshEnabled - If true, the SDK automatically\n * refreshes App Check tokens as needed. This overrides any value set\n * during `initializeAppCheck()`.\n * @public\n */\nexport function setTokenAutoRefreshEnabled(\n appCheckInstance: AppCheck,\n isTokenAutoRefreshEnabled: boolean\n): void {\n const app = appCheckInstance.app;\n const state = getStateReference(app);\n // This will exist if any product libraries have called\n // `addTokenListener()`\n if (state.tokenRefresher) {\n if (isTokenAutoRefreshEnabled === true) {\n state.tokenRefresher.start();\n } else {\n state.tokenRefresher.stop();\n }\n }\n state.isTokenAutoRefreshEnabled = isTokenAutoRefreshEnabled;\n}\n/**\n * Get the current App Check token. If `forceRefresh` is false, this function first\n * checks for a valid token in memory, then local persistence (IndexedDB).\n * If not found, or if `forceRefresh` is true, it makes a request to the\n * App Check endpoint for a fresh token. That request attaches\n * to the most recent in-flight request if one is present.\n *\n * @param appCheckInstance - The App Check service instance.\n * @param forceRefresh - If true, will always try to fetch a fresh token.\n * If false, will use a cached token if found in storage.\n * @public\n */\nexport async function getToken(\n appCheckInstance: AppCheck,\n forceRefresh?: boolean\n): Promise<AppCheckTokenResult> {\n const result = await getTokenInternal(\n appCheckInstance as AppCheckService,\n forceRefresh\n );\n if (result.error) {\n throw result.error;\n }\n if (result.internalError) {\n throw result.internalError;\n }\n return { token: result.token };\n}\n\n/**\n * Requests a Firebase App Check token. This method should be used\n * only if you need to authorize requests to a non-Firebase backend.\n *\n * Returns limited-use tokens that are intended for use with your\n * non-Firebase backend endpoints that are protected with\n * <a href=\"https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection\">\n * Replay Protection</a>. This method\n * does not affect the token generation behavior of the\n * #getAppCheckToken() method.\n *\n * @param appCheckInstance - The App Check service instance.\n * @returns The limited use token.\n * @public\n */\nexport function getLimitedUseToken(\n appCheckInstance: AppCheck\n): Promise<AppCheckTokenResult> {\n return getLimitedUseTokenInternal(appCheckInstance as AppCheckService);\n}\n\n/**\n * Registers a listener to changes in the token state. There can be more\n * than one listener registered at the same time for one or more\n * App Check instances. The listeners call back on the UI thread whenever\n * the current token associated with this App Check instance changes.\n *\n * @param appCheckInstance - The App Check service instance.\n * @param observer - An object with `next`, `error`, and `complete`\n * properties. `next` is called with an\n * {@link AppCheckTokenResult}\n * whenever the token changes. `error` is optional and is called if an\n * error is thrown by the listener (the `next` function). `complete`\n * is unused, as the token stream is unending.\n *\n * @returns A function that unsubscribes this listener.\n * @public\n */\nexport function onTokenChanged(\n appCheckInstance: AppCheck,\n observer: PartialObserver<AppCheckTokenResult>\n): Unsubscribe;\n/**\n * Registers a listener to changes in the token state. There can be more\n * than one listener registered at the same time for one or more\n * App Check instances. The listeners call back on the UI thread whenever\n * the current token associated with this App Check instance changes.\n *\n * @param appCheckInstance - The App Check service instance.\n * @param onNext - When the token changes, this function is called with an\n * {@link AppCheckTokenResult}.\n * @param onError - Optional. Called if there is an error thrown by the\n * listener (the `onNext` function).\n * @param onCompletion - Currently unused, as the token stream is unending.\n * @returns A function that unsubscribes this listener.\n * @public\n */\nexport function onTokenChanged(\n appCheckInstance: AppCheck,\n onNext: (tokenResult: AppCheckTokenResult) => void,\n onError?: (error: Error) => void,\n onCompletion?: () => void\n): Unsubscribe;\n/**\n * Wraps `addTokenListener`/`removeTokenListener` methods in an `Observer`\n * pattern for public use.\n */\nexport function onTokenChanged(\n appCheckInstance: AppCheck,\n onNextOrObserver:\n | ((tokenResult: AppCheckTokenResult) => void)\n | PartialObserver<AppCheckTokenResult>,\n onError?: (error: Error) => void,\n /**\n * NOTE: Although an `onCompletion` callback can be provided, it will\n * never be called because the token stream is never-ending.\n * It is added only for API consistency with the observer pattern, which\n * we follow in JS APIs.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onCompletion?: () => void\n): Unsubscribe {\n let nextFn: NextFn<AppCheckTokenResult> = () => {};\n let errorFn: ErrorFn = () => {};\n if ((onNextOrObserver as PartialObserver<AppCheckTokenResult>).next != null) {\n nextFn = (\n onNextOrObserver as PartialObserver<AppCheckTokenResult>\n ).next!.bind(onNextOrObserver);\n } else {\n nextFn = onNextOrObserver as NextFn<AppCheckTokenResult>;\n }\n if (\n (onNextOrObserver as PartialObserver<AppCheckTokenResult>).error != null\n ) {\n errorFn = (\n onNextOrObserver as PartialObserver<AppCheckTokenResult>\n ).error!.bind(onNextOrObserver);\n } else if (onError) {\n errorFn = onError;\n }\n addTokenListener(\n appCheckInstance as AppCheckService,\n ListenerType.EXTERNAL,\n nextFn,\n errorFn\n );\n return () => removeTokenListener(appCheckInstance.app, nextFn);\n}\n","/**\n * The Firebase App Check Web SDK.\n *\n * @remarks\n * Firebase App Check does not work in a Node.js environment using `ReCaptchaV3Provider` or\n * `ReCaptchaEnterpriseProvider`, but can be used in Node.js if you use\n * `CustomProvider` and write your own attestation method.\n *\n * @packageDocumentation\n */\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { registerVersion, _registerComponent } from '@firebase/app';\nimport {\n Component,\n ComponentType,\n InstantiationMode\n} from '@firebase/component';\nimport { _AppCheckComponentName } from './public-types';\nimport { factory, internalFactory } from './factory';\nimport { _AppCheckInternalComponentName } from './types';\nimport { name, version } from '../package.json';\n\n// Used by other Firebase packages.\nexport { _AppCheckInternalComponentName };\n\nexport * from './api';\nexport * from './public-types';\n\nconst APP_CHECK_NAME: _AppCheckComponentName = 'app-check';\nconst APP_CHECK_NAME_INTERNAL: _AppCheckInternalComponentName =\n 'app-check-internal';\nfunction registerAppCheck(): void {\n // The public interface\n _registerComponent(\n new Component(\n APP_CHECK_NAME,\n container => {\n // getImmediate for FirebaseApp will always succeed\n const app = container.getProvider('app').getImmediate();\n const heartbeatServiceProvider = container.getProvider('heartbeat');\n return factory(app, heartbeatServiceProvider);\n },\n ComponentType.PUBLIC\n )\n .setInstantiationMode(InstantiationMode.EXPLICIT)\n /**\n * Initialize app-check-internal after app-check is initialized to make AppCheck available to\n * other Firebase SDKs\n */\n .setInstanceCreatedCallback(\n (container, _identifier, _appcheckService) => {\n container.getProvider(APP_CHECK_NAME_INTERNAL).initialize();\n }\n )\n );\n\n // The internal interface used by other Firebase products\n _registerComponent(\n new Component(\n APP_CHECK_NAME_INTERNAL,\n container => {\n const appCheck = container.getProvider('app-check').getImmediate();\n return internalFactory(appCheck);\n },\n ComponentType.PUBLIC\n ).setInstantiationMode(InstantiationMode.EXPLICIT)\n );\n\n registerVersion(name, version);\n}\n\nregisterAppCheck();\n"],"names":["getToken","getLimitedUseToken","getReCAPTCHAToken","initializeRecaptchaV3","initializeRecaptchaEnterprise","getTokenInternal","getLimitedUseTokenInternal"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAoCH,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA8B,CAAC;AACxD,MAAM,aAAa,GAAkB;AAC1C,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,cAAc,EAAE,EAAE;CACnB,CAAC;AAEF,MAAM,WAAW,GAAe;AAC9B,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,OAAO,EAAE,KAAK;CACf,CAAC;AAEF;;AAEG;AACG,SAAU,iBAAiB,CAAC,GAAgB,EAAA;IAChD,OAAO,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,aAAa,EAAE,CAAC;AAC3D,CAAC;AAED;;;AAGG;AACa,SAAA,eAAe,CAC7B,GAAgB,EAChB,KAAoB,EAAA;AAEpB,IAAA,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACjC,IAAA,OAAO,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAkB,CAAC;AACpD,CAAC;SAUe,aAAa,GAAA;AAC3B,IAAA,OAAO,WAAW,CAAC;AACrB;;AC3FA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,aAAa,GACxB,oDAAoD,CAAC;AAEhD,MAAM,+BAA+B,GAAG,0BAA0B,CAAC;AACnE,MAAM,0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GAAG,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,YAAY,EAAE,CAAC;AACnE,QAAA,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACnC,KAAC,EAEF,QAAA,4BAAA,CAAC,oBAAoB,CAAA,UAAA,kCAA4B,CACnD,CAAC;AAEF,IAAA,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,gBAAgB,EAAE;;;;"} \ No newline at end of file
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/package.json b/frontend-old/node_modules/@firebase/app-check/dist/esm/package.json
deleted file mode 100644
index 7c34deb..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/package.json
+++ /dev/null
@@ -1 +0,0 @@
-{"type":"module"} \ No newline at end of file
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/api.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/api.d.ts
deleted file mode 100644
index def58a8..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/api.d.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { AppCheck, AppCheckOptions, AppCheckTokenResult, Unsubscribe, PartialObserver } from './public-types';
-import { FirebaseApp } from '@firebase/app';
-import { AppCheckService } from './factory';
-declare module '@firebase/component' {
- interface NameServiceMapping {
- 'app-check': AppCheckService;
- }
-}
-export { ReCaptchaV3Provider, CustomProvider, ReCaptchaEnterpriseProvider } from './providers';
-/**
- * Activate App Check for the given app. Can be called only once per app.
- * @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for
- * @param options - App Check initialization options
- * @public
- */
-export declare function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
-/**
- * Set whether App Check will automatically refresh tokens as needed.
- *
- * @param appCheckInstance - The App Check service instance.
- * @param isTokenAutoRefreshEnabled - If true, the SDK automatically
- * refreshes App Check tokens as needed. This overrides any value set
- * during `initializeAppCheck()`.
- * @public
- */
-export declare function setTokenAutoRefreshEnabled(appCheckInstance: AppCheck, isTokenAutoRefreshEnabled: boolean): void;
-/**
- * Get the current App Check token. If `forceRefresh` is false, this function first
- * checks for a valid token in memory, then local persistence (IndexedDB).
- * If not found, or if `forceRefresh` is true, it makes a request to the
- * App Check endpoint for a fresh token. That request attaches
- * to the most recent in-flight request if one is present.
- *
- * @param appCheckInstance - The App Check service instance.
- * @param forceRefresh - If true, will always try to fetch a fresh token.
- * If false, will use a cached token if found in storage.
- * @public
- */
-export declare function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;
-/**
- * Requests a Firebase App Check token. This method should be used
- * only if you need to authorize requests to a non-Firebase backend.
- *
- * Returns limited-use tokens that are intended for use with your
- * non-Firebase backend endpoints that are protected with
- * <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
- * Replay Protection</a>. This method
- * does not affect the token generation behavior of the
- * #getAppCheckToken() method.
- *
- * @param appCheckInstance - The App Check service instance.
- * @returns The limited use token.
- * @public
- */
-export declare function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult>;
-/**
- * Registers a listener to changes in the token state. There can be more
- * than one listener registered at the same time for one or more
- * App Check instances. The listeners call back on the UI thread whenever
- * the current token associated with this App Check instance changes.
- *
- * @param appCheckInstance - The App Check service instance.
- * @param observer - An object with `next`, `error`, and `complete`
- * properties. `next` is called with an
- * {@link AppCheckTokenResult}
- * whenever the token changes. `error` is optional and is called if an
- * error is thrown by the listener (the `next` function). `complete`
- * is unused, as the token stream is unending.
- *
- * @returns A function that unsubscribes this listener.
- * @public
- */
-export declare function onTokenChanged(appCheckInstance: AppCheck, observer: PartialObserver<AppCheckTokenResult>): Unsubscribe;
-/**
- * Registers a listener to changes in the token state. There can be more
- * than one listener registered at the same time for one or more
- * App Check instances. The listeners call back on the UI thread whenever
- * the current token associated with this App Check instance changes.
- *
- * @param appCheckInstance - The App Check service instance.
- * @param onNext - When the token changes, this function is called with an
- * {@link AppCheckTokenResult}.
- * @param onError - Optional. Called if there is an error thrown by the
- * listener (the `onNext` function).
- * @param onCompletion - Currently unused, as the token stream is unending.
- * @returns A function that unsubscribes this listener.
- * @public
- */
-export declare function onTokenChanged(appCheckInstance: AppCheck, onNext: (tokenResult: AppCheckTokenResult) => void, onError?: (error: Error) => void, onCompletion?: () => void): Unsubscribe;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/api.test.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/api.test.d.ts
deleted file mode 100644
index 68eefa5..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/api.test.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import '../test/setup';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/client.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/client.d.ts
deleted file mode 100644
index d49e05c..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/client.d.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { Provider } from '@firebase/component';
-import { AppCheckTokenInternal } from './types';
-interface AppCheckRequest {
- url: string;
- body: {
- [key: string]: string;
- };
-}
-export declare function exchangeToken({ url, body }: AppCheckRequest, heartbeatServiceProvider: Provider<'heartbeat'>): Promise<AppCheckTokenInternal>;
-export declare function getExchangeRecaptchaV3TokenRequest(app: FirebaseApp, reCAPTCHAToken: string): AppCheckRequest;
-export declare function getExchangeRecaptchaEnterpriseTokenRequest(app: FirebaseApp, reCAPTCHAToken: string): AppCheckRequest;
-export declare function getExchangeDebugTokenRequest(app: FirebaseApp, debugToken: string): AppCheckRequest;
-export {};
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/client.test.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/client.test.d.ts
deleted file mode 100644
index 68eefa5..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/client.test.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import '../test/setup';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/constants.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/constants.d.ts
deleted file mode 100644
index 2b1e3dc..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/constants.d.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-export declare const BASE_ENDPOINT = "https://content-firebaseappcheck.googleapis.com/v1";
-export declare const EXCHANGE_RECAPTCHA_TOKEN_METHOD = "exchangeRecaptchaV3Token";
-export declare const EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD = "exchangeRecaptchaEnterpriseToken";
-export declare const EXCHANGE_DEBUG_TOKEN_METHOD = "exchangeDebugToken";
-export declare const TOKEN_REFRESH_TIME: {
- /**
- * The offset time before token natural expiration to run the refresh.
- * This is currently 5 minutes.
- */
- OFFSET_DURATION: number;
- /**
- * This is the first retrial wait after an error. This is currently
- * 30 seconds.
- */
- RETRIAL_MIN_WAIT: number;
- /**
- * This is the maximum retrial wait, currently 16 minutes.
- */
- RETRIAL_MAX_WAIT: number;
-};
-/**
- * One day in millis, for certain error code backoffs.
- */
-export declare const ONE_DAY: number;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/debug.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/debug.d.ts
deleted file mode 100644
index c5abdf9..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/debug.d.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-declare global {
- var FIREBASE_APPCHECK_DEBUG_TOKEN: boolean | string | undefined;
-}
-export declare function isDebugMode(): boolean;
-export declare function getDebugToken(): Promise<string>;
-export declare function initializeDebugMode(): void;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/debug.test.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/debug.test.d.ts
deleted file mode 100644
index 68eefa5..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/debug.test.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import '../test/setup';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/errors.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/errors.d.ts
deleted file mode 100644
index c9549d8..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/errors.d.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { ErrorFactory } from '@firebase/util';
-export declare const enum AppCheckError {
- ALREADY_INITIALIZED = "already-initialized",
- USE_BEFORE_ACTIVATION = "use-before-activation",
- FETCH_NETWORK_ERROR = "fetch-network-error",
- FETCH_PARSE_ERROR = "fetch-parse-error",
- FETCH_STATUS_ERROR = "fetch-status-error",
- STORAGE_OPEN = "storage-open",
- STORAGE_GET = "storage-get",
- STORAGE_WRITE = "storage-set",
- RECAPTCHA_ERROR = "recaptcha-error",
- INITIAL_THROTTLE = "initial-throttle",
- THROTTLED = "throttled"
-}
-interface ErrorParams {
- [AppCheckError.ALREADY_INITIALIZED]: {
- appName: string;
- };
- [AppCheckError.USE_BEFORE_ACTIVATION]: {
- appName: string;
- };
- [AppCheckError.FETCH_NETWORK_ERROR]: {
- originalErrorMessage: string;
- };
- [AppCheckError.FETCH_PARSE_ERROR]: {
- originalErrorMessage: string;
- };
- [AppCheckError.FETCH_STATUS_ERROR]: {
- httpStatus: number;
- };
- [AppCheckError.STORAGE_OPEN]: {
- originalErrorMessage?: string;
- };
- [AppCheckError.STORAGE_GET]: {
- originalErrorMessage?: string;
- };
- [AppCheckError.STORAGE_WRITE]: {
- originalErrorMessage?: string;
- };
- [AppCheckError.INITIAL_THROTTLE]: {
- time: string;
- httpStatus: number;
- };
- [AppCheckError.THROTTLED]: {
- time: string;
- httpStatus: number;
- };
-}
-export declare const ERROR_FACTORY: ErrorFactory<AppCheckError, ErrorParams>;
-export {};
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/factory.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/factory.d.ts
deleted file mode 100644
index 805f982..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/factory.d.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { AppCheck } from './public-types';
-import { FirebaseApp, _FirebaseService } from '@firebase/app';
-import { FirebaseAppCheckInternal } from './types';
-import { Provider } from '@firebase/component';
-/**
- * AppCheck Service class.
- */
-export declare class AppCheckService implements AppCheck, _FirebaseService {
- app: FirebaseApp;
- heartbeatServiceProvider: Provider<'heartbeat'>;
- constructor(app: FirebaseApp, heartbeatServiceProvider: Provider<'heartbeat'>);
- _delete(): Promise<void>;
-}
-export declare function factory(app: FirebaseApp, heartbeatServiceProvider: Provider<'heartbeat'>): AppCheckService;
-export declare function internalFactory(appCheck: AppCheckService): FirebaseAppCheckInternal;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/index.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/index.d.ts
deleted file mode 100644
index 2d51c62..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/index.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * The Firebase App Check Web SDK.
- *
- * @remarks
- * Firebase App Check does not work in a Node.js environment using `ReCaptchaV3Provider` or
- * `ReCaptchaEnterpriseProvider`, but can be used in Node.js if you use
- * `CustomProvider` and write your own attestation method.
- *
- * @packageDocumentation
- */
-import { _AppCheckInternalComponentName } from './types';
-export { _AppCheckInternalComponentName };
-export * from './api';
-export * from './public-types';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/indexeddb.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/indexeddb.d.ts
deleted file mode 100644
index b6942da..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/indexeddb.d.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { AppCheckTokenInternal } from './types';
-export declare function readTokenFromIndexedDB(app: FirebaseApp): Promise<AppCheckTokenInternal | undefined>;
-export declare function writeTokenToIndexedDB(app: FirebaseApp, token?: AppCheckTokenInternal): Promise<void>;
-export declare function writeDebugTokenToIndexedDB(token: string): Promise<void>;
-export declare function readDebugTokenFromIndexedDB(): Promise<string | undefined>;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/internal-api.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/internal-api.d.ts
deleted file mode 100644
index a4f5fe3..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/internal-api.d.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { AppCheckTokenResult, AppCheckTokenInternal, ListenerType } from './types';
-import { AppCheckTokenListener } from './public-types';
-import { AppCheckService } from './factory';
-export declare const defaultTokenErrorData: {
- error: string;
-};
-/**
- * Stringify and base64 encode token error data.
- *
- * @param tokenError Error data, currently hardcoded.
- */
-export declare function formatDummyToken(tokenErrorData: Record<string, string>): string;
-/**
- * This function always resolves.
- * The result will contain an error field if there is any error.
- * In case there is an error, the token field in the result will be populated with a dummy value
- */
-export declare function getToken(appCheck: AppCheckService, forceRefresh?: boolean, shouldLogErrors?: boolean): Promise<AppCheckTokenResult>;
-/**
- * Internal API for limited use tokens. Skips all FAC state and simply calls
- * the underlying provider.
- */
-export declare function getLimitedUseToken(appCheck: AppCheckService): Promise<AppCheckTokenResult>;
-export declare function addTokenListener(appCheck: AppCheckService, type: ListenerType, listener: AppCheckTokenListener, onError?: (error: Error) => void): void;
-export declare function removeTokenListener(app: FirebaseApp, listener: AppCheckTokenListener): void;
-export declare function notifyTokenListeners(app: FirebaseApp, token: AppCheckTokenResult): void;
-export declare function isValid(token: AppCheckTokenInternal): boolean;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/internal-api.test.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/internal-api.test.d.ts
deleted file mode 100644
index 68eefa5..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/internal-api.test.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import '../test/setup';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/logger.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/logger.d.ts
deleted file mode 100644
index bfd6d07..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/logger.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { Logger } from '@firebase/logger';
-export declare const logger: Logger;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/proactive-refresh.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/proactive-refresh.d.ts
deleted file mode 100644
index d90731c..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/proactive-refresh.d.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Port from auth proactiverefresh.js
- *
- */
-export declare class Refresher {
- private readonly operation;
- private readonly retryPolicy;
- private readonly getWaitDuration;
- private readonly lowerBound;
- private readonly upperBound;
- private pending;
- private nextErrorWaitInterval;
- constructor(operation: () => Promise<unknown>, retryPolicy: (error: unknown) => boolean, getWaitDuration: () => number, lowerBound: number, upperBound: number);
- start(): void;
- stop(): void;
- isRunning(): boolean;
- private process;
- private getNextRun;
-}
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/proactive-refresh.test.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/proactive-refresh.test.d.ts
deleted file mode 100644
index 68eefa5..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/proactive-refresh.test.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import '../test/setup';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/providers.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/providers.d.ts
deleted file mode 100644
index 787cea7..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/providers.d.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * @license
- * Copyright 2021 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { CustomProviderOptions } from './public-types';
-import { AppCheckProvider, AppCheckTokenInternal } from './types';
-/**
- * App Check provider that can obtain a reCAPTCHA V3 token and exchange it
- * for an App Check token.
- *
- * @public
- */
-export declare class ReCaptchaV3Provider implements AppCheckProvider {
- private _siteKey;
- private _app?;
- private _heartbeatServiceProvider?;
- /**
- * Throttle requests on certain error codes to prevent too many retries
- * in a short time.
- */
- private _throttleData;
- /**
- * Create a ReCaptchaV3Provider instance.
- * @param siteKey - ReCAPTCHA V3 siteKey.
- */
- constructor(_siteKey: string);
- /**
- * Returns an App Check token.
- * @internal
- */
- getToken(): Promise<AppCheckTokenInternal>;
- /**
- * @internal
- */
- initialize(app: FirebaseApp): void;
- /**
- * @internal
- */
- isEqual(otherProvider: unknown): boolean;
-}
-/**
- * App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it
- * for an App Check token.
- *
- * @public
- */
-export declare class ReCaptchaEnterpriseProvider implements AppCheckProvider {
- private _siteKey;
- private _app?;
- private _heartbeatServiceProvider?;
- /**
- * Throttle requests on certain error codes to prevent too many retries
- * in a short time.
- */
- private _throttleData;
- /**
- * Create a ReCaptchaEnterpriseProvider instance.
- * @param siteKey - reCAPTCHA Enterprise score-based site key.
- */
- constructor(_siteKey: string);
- /**
- * Returns an App Check token.
- * @internal
- */
- getToken(): Promise<AppCheckTokenInternal>;
- /**
- * @internal
- */
- initialize(app: FirebaseApp): void;
- /**
- * @internal
- */
- isEqual(otherProvider: unknown): boolean;
-}
-/**
- * Custom provider class.
- * @public
- */
-export declare class CustomProvider implements AppCheckProvider {
- private _customProviderOptions;
- private _app?;
- constructor(_customProviderOptions: CustomProviderOptions);
- /**
- * @internal
- */
- getToken(): Promise<AppCheckTokenInternal>;
- /**
- * @internal
- */
- initialize(app: FirebaseApp): void;
- /**
- * @internal
- */
- isEqual(otherProvider: unknown): boolean;
-}
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/providers.test.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/providers.test.d.ts
deleted file mode 100644
index c5efdd9..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/providers.test.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2021 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import '../test/setup';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/public-types.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/public-types.d.ts
deleted file mode 100644
index 0fe5708..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/public-types.d.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * @license
- * Copyright 2021 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider } from './providers';
-export { Unsubscribe, PartialObserver } from '@firebase/util';
-/**
- * The Firebase App Check service interface.
- *
- * @public
- */
-export interface AppCheck {
- /**
- * The {@link @firebase/app#FirebaseApp} this `AppCheck` instance is associated with.
- */
- app: FirebaseApp;
-}
-/**
- * The token returned from an App Check provider.
- * @public
- */
-export interface AppCheckToken {
- readonly token: string;
- /**
- * The local timestamp after which the token will expire.
- */
- readonly expireTimeMillis: number;
-}
-/**
- * @internal
- */
-export type _AppCheckComponentName = 'app-check';
-/**
- * Options for App Check initialization.
- * @public
- */
-export interface AppCheckOptions {
- /**
- * A reCAPTCHA V3 provider, reCAPTCHA Enterprise provider, or custom provider.
- */
- provider: CustomProvider | ReCaptchaV3Provider | ReCaptchaEnterpriseProvider;
- /**
- * If set to true, enables automatic background refresh of App Check token.
- */
- isTokenAutoRefreshEnabled?: boolean;
-}
-/**
- * Options when creating a {@link CustomProvider}.
- * @public
- */
-export interface CustomProviderOptions {
- /**
- * Function to get an App Check token through a custom provider
- * service.
- */
- getToken: () => Promise<AppCheckToken>;
-}
-/**
- * Result returned by `getToken()`.
- * @public
- */
-export interface AppCheckTokenResult {
- /**
- * The token string in JWT format.
- */
- readonly token: string;
-}
-/**
- * A listener that is called whenever the App Check token changes.
- * @public
- */
-export type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/recaptcha.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/recaptcha.d.ts
deleted file mode 100644
index 22a51d2..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/recaptcha.d.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-export declare const RECAPTCHA_URL = "https://www.google.com/recaptcha/api.js";
-export declare const RECAPTCHA_ENTERPRISE_URL = "https://www.google.com/recaptcha/enterprise.js";
-export declare function initializeV3(app: FirebaseApp, siteKey: string): Promise<GreCAPTCHA>;
-export declare function initializeEnterprise(app: FirebaseApp, siteKey: string): Promise<GreCAPTCHA>;
-export declare function getToken(app: FirebaseApp): Promise<string>;
-declare global {
- interface Window {
- grecaptcha: GreCAPTCHATopLevel | undefined;
- }
-}
-export interface GreCAPTCHATopLevel extends GreCAPTCHA {
- enterprise: GreCAPTCHA;
-}
-export interface GreCAPTCHA {
- ready: (callback: () => void) => void;
- execute: (siteKey: string, options: {
- action: string;
- }) => Promise<string>;
- render: (container: string | HTMLElement, parameters: GreCAPTCHARenderOption) => string;
-}
-export interface GreCAPTCHARenderOption {
- sitekey: string;
- size: 'invisible';
- callback: () => void;
- 'error-callback': () => void;
-}
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/recaptcha.test.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/recaptcha.test.d.ts
deleted file mode 100644
index 68eefa5..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/recaptcha.test.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import '../test/setup';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/state.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/state.d.ts
deleted file mode 100644
index 698374b..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/state.d.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { AppCheckProvider, AppCheckTokenInternal, AppCheckTokenObserver } from './types';
-import { Refresher } from './proactive-refresh';
-import { Deferred } from '@firebase/util';
-import { GreCAPTCHA } from './recaptcha';
-export interface AppCheckState {
- activated: boolean;
- tokenObservers: AppCheckTokenObserver[];
- provider?: AppCheckProvider;
- token?: AppCheckTokenInternal;
- cachedTokenPromise?: Promise<AppCheckTokenInternal | undefined>;
- exchangeTokenPromise?: Promise<AppCheckTokenInternal>;
- tokenRefresher?: Refresher;
- reCAPTCHAState?: ReCAPTCHAState;
- isTokenAutoRefreshEnabled?: boolean;
-}
-export interface ReCAPTCHAState {
- initialized: Deferred<GreCAPTCHA>;
- widgetId?: string;
- succeeded?: boolean;
-}
-export interface DebugState {
- initialized: boolean;
- enabled: boolean;
- token?: Deferred<string>;
-}
-export declare const DEFAULT_STATE: AppCheckState;
-/**
- * Gets a reference to the state object.
- */
-export declare function getStateReference(app: FirebaseApp): AppCheckState;
-/**
- * Set once on initialization. The map should hold the same reference to the
- * same object until this entry is deleted.
- */
-export declare function setInitialState(app: FirebaseApp, state: AppCheckState): AppCheckState;
-export declare function clearState(): void;
-export declare function getDebugState(): DebugState;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/storage.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/storage.d.ts
deleted file mode 100644
index b1dfd96..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/storage.d.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { AppCheckTokenInternal } from './types';
-/**
- * Always resolves. In case of an error reading from indexeddb, resolve with undefined
- */
-export declare function readTokenFromStorage(app: FirebaseApp): Promise<AppCheckTokenInternal | undefined>;
-/**
- * Always resolves. In case of an error writing to indexeddb, print a warning and resolve the promise
- */
-export declare function writeTokenToStorage(app: FirebaseApp, token?: AppCheckTokenInternal): Promise<void>;
-export declare function readOrCreateDebugTokenFromStorage(): Promise<string>;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/storage.test.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/storage.test.d.ts
deleted file mode 100644
index 68eefa5..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/storage.test.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import '../test/setup';
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/types.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/types.d.ts
deleted file mode 100644
index e1b916c..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/types.d.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * @license
- * Copyright 2021 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { PartialObserver } from '@firebase/util';
-import { AppCheckToken, AppCheckTokenListener } from './public-types';
-export interface FirebaseAppCheckInternal {
- getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
- getLimitedUseToken(): Promise<AppCheckTokenResult>;
- addTokenListener(listener: AppCheckTokenListener): void;
- removeTokenListener(listener: AppCheckTokenListener): void;
-}
-export interface AppCheckTokenObserver extends PartialObserver<AppCheckTokenResult> {
- next: AppCheckTokenListener;
- type: ListenerType;
-}
-export declare const enum ListenerType {
- 'INTERNAL' = "INTERNAL",
- 'EXTERNAL' = "EXTERNAL"
-}
-export interface AppCheckTokenResult {
- readonly token: string;
- readonly error?: Error;
- readonly internalError?: Error;
-}
-export interface AppCheckTokenInternal extends AppCheckToken {
- issuedAtTimeMillis: number;
-}
-export interface AppCheckProvider {
- /**
- * Returns an App Check token.
- * @internal
- */
- getToken: () => Promise<AppCheckTokenInternal>;
- /**
- * @internal
- */
- initialize(app: FirebaseApp): void;
-}
-/**
- * @internal
- */
-export type _AppCheckInternalComponentName = 'app-check-internal';
-export interface ThrottleData {
- allowRequestsAfter: number;
- backoffCount: number;
- httpStatus: number;
-}
-declare module '@firebase/component' {
- interface NameServiceMapping {
- 'app-check-internal': FirebaseAppCheckInternal;
- }
-}
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/util.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/src/util.d.ts
deleted file mode 100644
index 29cc2e3..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/src/util.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { GreCAPTCHA } from './recaptcha';
-import { FirebaseApp } from '@firebase/app';
-export declare function getRecaptcha(isEnterprise?: boolean): GreCAPTCHA | undefined;
-export declare function ensureActivated(app: FirebaseApp): void;
-export declare function getDurationString(durationInMillis: number): string;
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/test/setup.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/test/setup.d.ts
deleted file mode 100644
index 731d2d9..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/test/setup.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-export {};
diff --git a/frontend-old/node_modules/@firebase/app-check/dist/esm/test/util.d.ts b/frontend-old/node_modules/@firebase/app-check/dist/esm/test/util.d.ts
deleted file mode 100644
index 3590096..0000000
--- a/frontend-old/node_modules/@firebase/app-check/dist/esm/test/util.d.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { FirebaseApp } from '@firebase/app';
-import { GreCAPTCHA, GreCAPTCHATopLevel } from '../src/recaptcha';
-import { Provider } from '@firebase/component';
-import { AppCheck, CustomProvider } from '../src';
-export declare const FAKE_SITE_KEY = "fake-site-key";
-export declare function getFakeApp(overrides?: Record<string, any>): FirebaseApp;
-export declare function getFakeAppCheck(app: FirebaseApp): AppCheck;
-export declare function getFullApp(): FirebaseApp;
-export declare function getFakeCustomTokenProvider(): CustomProvider;
-export declare function getFakeHeartbeatServiceProvider(fakeLogString?: string): Provider<'heartbeat'>;
-export declare function getFakeGreCAPTCHA(isTopLevel?: boolean): GreCAPTCHATopLevel | GreCAPTCHA;
-/**
- * Returns all script tags in DOM matching our reCAPTCHA url pattern.
- * Tests in other files may have inserted multiple reCAPTCHA scripts, because they don't
- * care about it.
- */
-export declare function findgreCAPTCHAScriptsOnPage(): HTMLScriptElement[];
-export declare function removegreCAPTCHAScriptsOnPage(): void;