Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,32 @@
/**
* @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.
*/
/**
* This is the file that people using Cordova will actually import. You
* should only include this file if you have something specific about your
* implementation that mandates having a separate entrypoint. Otherwise you can
* just use index.ts
*/
import { FirebaseApp } from '@firebase/app';
import { Auth } from './src/model/public_types';
export * from './index.shared';
export { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db';
export { browserLocalPersistence } from './src/platform_browser/persistence/local_storage';
export { browserSessionPersistence } from './src/platform_browser/persistence/session_storage';
export { getRedirectResult } from './src/platform_browser/strategies/redirect';
export { cordovaPopupRedirectResolver } from './src/platform_cordova/popup_redirect/popup_redirect';
export { signInWithRedirect, reauthenticateWithRedirect, linkWithRedirect } from './src/platform_cordova/strategies/redirect';
export declare function getAuth(app?: FirebaseApp): Auth;

View file

@ -0,0 +1,37 @@
/**
* Firebase Authentication
*
* @packageDocumentation
*/
/**
* @license
* Copyright 2017 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 * from './src/model/public_types';
export { FactorId, ProviderId, SignInMethod, OperationType, ActionCodeOperation } from './src/model/enum_maps';
export * from './src';
import { browserLocalPersistence } from './src/platform_browser/persistence/local_storage';
import { browserSessionPersistence } from './src/platform_browser/persistence/session_storage';
import { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db';
import { PhoneAuthProvider } from './src/platform_browser/providers/phone';
import { signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber } from './src/platform_browser/strategies/phone';
import { signInWithPopup, linkWithPopup, reauthenticateWithPopup } from './src/platform_browser/strategies/popup';
import { signInWithRedirect, linkWithRedirect, reauthenticateWithRedirect, getRedirectResult } from './src/platform_browser/strategies/redirect';
import { RecaptchaVerifier } from './src/platform_browser/recaptcha/recaptcha_verifier';
import { browserPopupRedirectResolver } from './src/platform_browser/popup_redirect';
import { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';
import { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp';
import { getAuth } from './src/platform_browser';
export { browserLocalPersistence, browserSessionPersistence, indexedDBLocalPersistence, PhoneAuthProvider, signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber, signInWithPopup, linkWithPopup, reauthenticateWithPopup, signInWithRedirect, linkWithRedirect, reauthenticateWithRedirect, getRedirectResult, RecaptchaVerifier, browserPopupRedirectResolver, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, TotpSecret, getAuth };

View file

@ -0,0 +1,24 @@
/**
* Firebase Authentication
*
* @packageDocumentation
*/
/**
* @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.
*/
export * from './index';
export { cordovaPopupRedirectResolver } from './index.cordova';
export { getReactNativePersistence } from './index.rn';

98
node_modules/@firebase/auth/dist/browser-cjs/index.js generated vendored Normal file
View file

@ -0,0 +1,98 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var index = require('./index-b60d3212.js');
require('@firebase/app');
require('@firebase/util');
require('@firebase/logger');
require('tslib');
require('@firebase/component');
exports.ActionCodeOperation = index.ActionCodeOperation;
exports.ActionCodeURL = index.ActionCodeURL;
exports.AuthCredential = index.AuthCredential;
exports.AuthErrorCodes = index.AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY;
exports.EmailAuthCredential = index.EmailAuthCredential;
exports.EmailAuthProvider = index.EmailAuthProvider;
exports.FacebookAuthProvider = index.FacebookAuthProvider;
exports.FactorId = index.FactorId;
exports.GithubAuthProvider = index.GithubAuthProvider;
exports.GoogleAuthProvider = index.GoogleAuthProvider;
exports.OAuthCredential = index.OAuthCredential;
exports.OAuthProvider = index.OAuthProvider;
exports.OperationType = index.OperationType;
exports.PhoneAuthCredential = index.PhoneAuthCredential;
exports.PhoneAuthProvider = index.PhoneAuthProvider;
exports.PhoneMultiFactorGenerator = index.PhoneMultiFactorGenerator;
exports.ProviderId = index.ProviderId;
exports.RecaptchaVerifier = index.RecaptchaVerifier;
exports.SAMLAuthProvider = index.SAMLAuthProvider;
exports.SignInMethod = index.SignInMethod;
exports.TotpMultiFactorGenerator = index.TotpMultiFactorGenerator;
exports.TotpSecret = index.TotpSecret;
exports.TwitterAuthProvider = index.TwitterAuthProvider;
exports.applyActionCode = index.applyActionCode;
exports.beforeAuthStateChanged = index.beforeAuthStateChanged;
exports.browserLocalPersistence = index.browserLocalPersistence;
exports.browserPopupRedirectResolver = index.browserPopupRedirectResolver;
exports.browserSessionPersistence = index.browserSessionPersistence;
exports.checkActionCode = index.checkActionCode;
exports.confirmPasswordReset = index.confirmPasswordReset;
exports.connectAuthEmulator = index.connectAuthEmulator;
exports.createUserWithEmailAndPassword = index.createUserWithEmailAndPassword;
exports.debugErrorMap = index.debugErrorMap;
exports.deleteUser = index.deleteUser;
exports.fetchSignInMethodsForEmail = index.fetchSignInMethodsForEmail;
exports.getAdditionalUserInfo = index.getAdditionalUserInfo;
exports.getAuth = index.getAuth;
exports.getIdToken = index.getIdToken;
exports.getIdTokenResult = index.getIdTokenResult;
exports.getMultiFactorResolver = index.getMultiFactorResolver;
exports.getRedirectResult = index.getRedirectResult;
exports.inMemoryPersistence = index.inMemoryPersistence;
exports.indexedDBLocalPersistence = index.indexedDBLocalPersistence;
exports.initializeAuth = index.initializeAuth;
exports.initializeRecaptchaConfig = index.initializeRecaptchaConfig;
exports.isSignInWithEmailLink = index.isSignInWithEmailLink;
exports.linkWithCredential = index.linkWithCredential;
exports.linkWithPhoneNumber = index.linkWithPhoneNumber;
exports.linkWithPopup = index.linkWithPopup;
exports.linkWithRedirect = index.linkWithRedirect;
exports.multiFactor = index.multiFactor;
exports.onAuthStateChanged = index.onAuthStateChanged;
exports.onIdTokenChanged = index.onIdTokenChanged;
exports.parseActionCodeURL = index.parseActionCodeURL;
exports.prodErrorMap = index.prodErrorMap;
exports.reauthenticateWithCredential = index.reauthenticateWithCredential;
exports.reauthenticateWithPhoneNumber = index.reauthenticateWithPhoneNumber;
exports.reauthenticateWithPopup = index.reauthenticateWithPopup;
exports.reauthenticateWithRedirect = index.reauthenticateWithRedirect;
exports.reload = index.reload;
exports.revokeAccessToken = index.revokeAccessToken;
exports.sendEmailVerification = index.sendEmailVerification;
exports.sendPasswordResetEmail = index.sendPasswordResetEmail;
exports.sendSignInLinkToEmail = index.sendSignInLinkToEmail;
exports.setPersistence = index.setPersistence;
exports.signInAnonymously = index.signInAnonymously;
exports.signInWithCredential = index.signInWithCredential;
exports.signInWithCustomToken = index.signInWithCustomToken;
exports.signInWithEmailAndPassword = index.signInWithEmailAndPassword;
exports.signInWithEmailLink = index.signInWithEmailLink;
exports.signInWithPhoneNumber = index.signInWithPhoneNumber;
exports.signInWithPopup = index.signInWithPopup;
exports.signInWithRedirect = index.signInWithRedirect;
exports.signOut = index.signOut;
exports.unlink = index.unlink;
exports.updateCurrentUser = index.updateCurrentUser;
exports.updateEmail = index.updateEmail;
exports.updatePassword = index.updatePassword;
exports.updatePhoneNumber = index.updatePhoneNumber;
exports.updateProfile = index.updateProfile;
exports.useDeviceLanguage = index.useDeviceLanguage;
exports.validatePassword = index.validatePassword;
exports.verifyBeforeUpdateEmail = index.verifyBeforeUpdateEmail;
exports.verifyPasswordResetCode = index.verifyPasswordResetCode;
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View file

@ -0,0 +1,17 @@
/**
* @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.
*/
export * from './index';

View file

@ -0,0 +1,40 @@
/**
* @license
* Copyright 2017 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.
*/
/**
* This is the file that people using React Native will actually import. You
* should only include this file if you have something specific about your
* implementation that mandates having a separate entrypoint. Otherwise you can
* just use index.ts
*/
import { FirebaseApp } from '@firebase/app';
import { Auth, Dependencies } from './src/model/public_types';
export * from './index.shared';
export { PhoneAuthProvider } from './src/platform_browser/providers/phone';
export { signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber } from './src/platform_browser/strategies/phone';
export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';
export { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp';
export { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';
export declare function getAuth(app?: FirebaseApp): Auth;
/**
* Wrapper around base `initializeAuth()` for RN users only, which
* shows the warning message if no persistence is provided.
* Double-checked potential collision with `export * from './index.shared'`
* as `./index.shared` also exports `initializeAuth()`, and the final
* bundle does correctly export only this `initializeAuth()` function
* and not the one from index.shared.
*/
export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth;

View file

@ -0,0 +1,19 @@
/**
* @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.
*/
export * from './src/model/public_types';
export { FactorId, ProviderId, SignInMethod, OperationType, ActionCodeOperation } from './src/model/enum_maps';
export * from './src';

View file

@ -0,0 +1,31 @@
/**
* @license
* Copyright 2023 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 * from './src';
import { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db';
import { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp';
import { FirebaseApp } from '@firebase/app';
import { Auth } from './index.shared';
/**
* Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}.
* If no instance exists, initializes an Auth instance with platform-specific default dependencies.
*
* @param app - The Firebase App.
*
* @public
*/
declare function getAuth(app?: FirebaseApp): Auth;
export { indexedDBLocalPersistence, TotpMultiFactorGenerator, TotpSecret, getAuth };

View file

@ -0,0 +1,21 @@
/**
* @license
* Copyright 2017 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 { Auth } from './src/model/public_types';
export * from './index.shared';
export { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db';
export declare function getAuth(app?: FirebaseApp): Auth;

View file

@ -0,0 +1,672 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var index = require('./index-b60d3212.js');
var util = require('@firebase/util');
require('@firebase/app');
require('@firebase/logger');
require('tslib');
require('@firebase/component');
/**
* @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.
*/
function _cordovaWindow() {
return window;
}
/**
* @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.
*/
/**
* How long to wait after the app comes back into focus before concluding that
* the user closed the sign in tab.
*/
const REDIRECT_TIMEOUT_MS = 2000;
/**
* Generates the URL for the OAuth handler.
*/
async function _generateHandlerUrl(auth, event, provider) {
var _a;
// Get the cordova plugins
const { BuildInfo } = _cordovaWindow();
index.debugAssert(event.sessionId, 'AuthEvent did not contain a session ID');
const sessionDigest = await computeSha256(event.sessionId);
const additionalParams = {};
if (index._isIOS()) {
// iOS app identifier
additionalParams['ibi'] = BuildInfo.packageName;
}
else if (index._isAndroid()) {
// Android app identifier
additionalParams['apn'] = BuildInfo.packageName;
}
else {
index._fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
}
// Add the display name if available
if (BuildInfo.displayName) {
additionalParams['appDisplayName'] = BuildInfo.displayName;
}
// Attached the hashed session ID
additionalParams['sessionId'] = sessionDigest;
return index._getRedirectUrl(auth, provider, event.type, undefined, (_a = event.eventId) !== null && _a !== void 0 ? _a : undefined, additionalParams);
}
/**
* Validates that this app is valid for this project configuration
*/
async function _validateOrigin(auth) {
const { BuildInfo } = _cordovaWindow();
const request = {};
if (index._isIOS()) {
request.iosBundleId = BuildInfo.packageName;
}
else if (index._isAndroid()) {
request.androidPackageName = BuildInfo.packageName;
}
else {
index._fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
}
// Will fail automatically if package name is not authorized
await index._getProjectConfig(auth, request);
}
function _performRedirect(handlerUrl) {
// Get the cordova plugins
const { cordova } = _cordovaWindow();
return new Promise(resolve => {
cordova.plugins.browsertab.isAvailable(browserTabIsAvailable => {
let iabRef = null;
if (browserTabIsAvailable) {
cordova.plugins.browsertab.openUrl(handlerUrl);
}
else {
// TODO: Return the inappbrowser ref that's returned from the open call
iabRef = cordova.InAppBrowser.open(handlerUrl, index._isIOS7Or8() ? '_blank' : '_system', 'location=yes');
}
resolve(iabRef);
});
});
}
/**
* This function waits for app activity to be seen before resolving. It does
* this by attaching listeners to various dom events. Once the app is determined
* to be visible, this promise resolves. AFTER that resolution, the listeners
* are detached and any browser tabs left open will be closed.
*/
async function _waitForAppResume(auth, eventListener, iabRef) {
// Get the cordova plugins
const { cordova } = _cordovaWindow();
let cleanup = () => { };
try {
await new Promise((resolve, reject) => {
let onCloseTimer = null;
// DEFINE ALL THE CALLBACKS =====
function authEventSeen() {
var _a;
// Auth event was detected. Resolve this promise and close the extra
// window if it's still open.
resolve();
const closeBrowserTab = (_a = cordova.plugins.browsertab) === null || _a === void 0 ? void 0 : _a.close;
if (typeof closeBrowserTab === 'function') {
closeBrowserTab();
}
// Close inappbrowser embedded webview in iOS7 and 8 case if still
// open.
if (typeof (iabRef === null || iabRef === void 0 ? void 0 : iabRef.close) === 'function') {
iabRef.close();
}
}
function resumed() {
if (onCloseTimer) {
// This code already ran; do not rerun.
return;
}
onCloseTimer = window.setTimeout(() => {
// Wait two seconds after resume then reject.
reject(index._createError(auth, "redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */));
}, REDIRECT_TIMEOUT_MS);
}
function visibilityChanged() {
if ((document === null || document === void 0 ? void 0 : document.visibilityState) === 'visible') {
resumed();
}
}
// ATTACH ALL THE LISTENERS =====
// Listen for the auth event
eventListener.addPassiveListener(authEventSeen);
// Listen for resume and visibility events
document.addEventListener('resume', resumed, false);
if (index._isAndroid()) {
document.addEventListener('visibilitychange', visibilityChanged, false);
}
// SETUP THE CLEANUP FUNCTION =====
cleanup = () => {
eventListener.removePassiveListener(authEventSeen);
document.removeEventListener('resume', resumed, false);
document.removeEventListener('visibilitychange', visibilityChanged, false);
if (onCloseTimer) {
window.clearTimeout(onCloseTimer);
}
};
});
}
finally {
cleanup();
}
}
/**
* Checks the configuration of the Cordova environment. This has no side effect
* if the configuration is correct; otherwise it throws an error with the
* missing plugin.
*/
function _checkCordovaConfiguration(auth) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
const win = _cordovaWindow();
// Check all dependencies installed.
// https://github.com/nordnet/cordova-universal-links-plugin
// Note that cordova-universal-links-plugin has been abandoned.
// A fork with latest fixes is available at:
// https://www.npmjs.com/package/cordova-universal-links-plugin-fix
index._assert(typeof ((_a = win === null || win === void 0 ? void 0 : win.universalLinks) === null || _a === void 0 ? void 0 : _a.subscribe) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
missingPlugin: 'cordova-universal-links-plugin-fix'
});
// https://www.npmjs.com/package/cordova-plugin-buildinfo
index._assert(typeof ((_b = win === null || win === void 0 ? void 0 : win.BuildInfo) === null || _b === void 0 ? void 0 : _b.packageName) !== 'undefined', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
missingPlugin: 'cordova-plugin-buildInfo'
});
// https://github.com/google/cordova-plugin-browsertab
index._assert(typeof ((_e = (_d = (_c = win === null || win === void 0 ? void 0 : win.cordova) === null || _c === void 0 ? void 0 : _c.plugins) === null || _d === void 0 ? void 0 : _d.browsertab) === null || _e === void 0 ? void 0 : _e.openUrl) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
missingPlugin: 'cordova-plugin-browsertab'
});
index._assert(typeof ((_h = (_g = (_f = win === null || win === void 0 ? void 0 : win.cordova) === null || _f === void 0 ? void 0 : _f.plugins) === null || _g === void 0 ? void 0 : _g.browsertab) === null || _h === void 0 ? void 0 : _h.isAvailable) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
missingPlugin: 'cordova-plugin-browsertab'
});
// https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
index._assert(typeof ((_k = (_j = win === null || win === void 0 ? void 0 : win.cordova) === null || _j === void 0 ? void 0 : _j.InAppBrowser) === null || _k === void 0 ? void 0 : _k.open) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
missingPlugin: 'cordova-plugin-inappbrowser'
});
}
/**
* Computes the SHA-256 of a session ID. The SubtleCrypto interface is only
* available in "secure" contexts, which covers Cordova (which is served on a file
* protocol).
*/
async function computeSha256(sessionId) {
const bytes = stringToArrayBuffer(sessionId);
// TODO: For IE11 crypto has a different name and this operation comes back
// as an object, not a promise. This is the old proposed standard that
// is used by IE11:
// https://www.w3.org/TR/2013/WD-WebCryptoAPI-20130108/#cryptooperation-interface
const buf = await crypto.subtle.digest('SHA-256', bytes);
const arr = Array.from(new Uint8Array(buf));
return arr.map(num => num.toString(16).padStart(2, '0')).join('');
}
function stringToArrayBuffer(str) {
// This function is only meant to deal with an ASCII charset and makes
// certain simplifying assumptions.
index.debugAssert(/[0-9a-zA-Z]+/.test(str), 'Can only convert alpha-numeric strings');
if (typeof TextEncoder !== 'undefined') {
return new TextEncoder().encode(str);
}
const buff = new ArrayBuffer(str.length);
const view = new Uint8Array(buff);
for (let i = 0; i < str.length; i++) {
view[i] = str.charCodeAt(i);
}
return view;
}
/**
* @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 SESSION_ID_LENGTH = 20;
/** Custom AuthEventManager that adds passive listeners to events */
class CordovaAuthEventManager extends index.AuthEventManager {
constructor() {
super(...arguments);
this.passiveListeners = new Set();
this.initPromise = new Promise(resolve => {
this.resolveInitialized = resolve;
});
}
addPassiveListener(cb) {
this.passiveListeners.add(cb);
}
removePassiveListener(cb) {
this.passiveListeners.delete(cb);
}
// In a Cordova environment, this manager can live through multiple redirect
// operations
resetRedirect() {
this.queuedRedirectEvent = null;
this.hasHandledPotentialRedirect = false;
}
/** Override the onEvent method */
onEvent(event) {
this.resolveInitialized();
this.passiveListeners.forEach(cb => cb(event));
return super.onEvent(event);
}
async initialized() {
await this.initPromise;
}
}
/**
* Generates a (partial) {@link AuthEvent}.
*/
function _generateNewEvent(auth, type, eventId = null) {
return {
type,
eventId,
urlResponse: null,
sessionId: generateSessionId(),
postBody: null,
tenantId: auth.tenantId,
error: index._createError(auth, "no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */)
};
}
function _savePartialEvent(auth, event) {
return storage()._set(persistenceKey(auth), event);
}
async function _getAndRemoveEvent(auth) {
const event = (await storage()._get(persistenceKey(auth)));
if (event) {
await storage()._remove(persistenceKey(auth));
}
return event;
}
function _eventFromPartialAndUrl(partialEvent, url) {
var _a, _b;
// Parse the deep link within the dynamic link URL.
const callbackUrl = _getDeepLinkFromCallback(url);
// Confirm it is actually a callback URL.
// Currently the universal link will be of this format:
// https://<AUTH_DOMAIN>/__/auth/callback<OAUTH_RESPONSE>
// This is a fake URL but is not intended to take the user anywhere
// and just redirect to the app.
if (callbackUrl.includes('/__/auth/callback')) {
// Check if there is an error in the URL.
// This mechanism is also used to pass errors back to the app:
// https://<AUTH_DOMAIN>/__/auth/callback?firebaseError=<STRINGIFIED_ERROR>
const params = searchParamsOrEmpty(callbackUrl);
// Get the error object corresponding to the stringified error if found.
const errorObject = params['firebaseError']
? parseJsonOrNull(decodeURIComponent(params['firebaseError']))
: null;
const code = (_b = (_a = errorObject === null || errorObject === void 0 ? void 0 : errorObject['code']) === null || _a === void 0 ? void 0 : _a.split('auth/')) === null || _b === void 0 ? void 0 : _b[1];
const error = code ? index._createError(code) : null;
if (error) {
return {
type: partialEvent.type,
eventId: partialEvent.eventId,
tenantId: partialEvent.tenantId,
error,
urlResponse: null,
sessionId: null,
postBody: null
};
}
else {
return {
type: partialEvent.type,
eventId: partialEvent.eventId,
tenantId: partialEvent.tenantId,
sessionId: partialEvent.sessionId,
urlResponse: callbackUrl,
postBody: null
};
}
}
return null;
}
function generateSessionId() {
const chars = [];
const allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for (let i = 0; i < SESSION_ID_LENGTH; i++) {
const idx = Math.floor(Math.random() * allowedChars.length);
chars.push(allowedChars.charAt(idx));
}
return chars.join('');
}
function storage() {
return index._getInstance(index.browserLocalPersistence);
}
function persistenceKey(auth) {
return index._persistenceKeyName("authEvent" /* KeyName.AUTH_EVENT */, auth.config.apiKey, auth.name);
}
function parseJsonOrNull(json) {
try {
return JSON.parse(json);
}
catch (e) {
return null;
}
}
// Exported for testing
function _getDeepLinkFromCallback(url) {
const params = searchParamsOrEmpty(url);
const link = params['link'] ? decodeURIComponent(params['link']) : undefined;
// Double link case (automatic redirect)
const doubleDeepLink = searchParamsOrEmpty(link)['link'];
// iOS custom scheme links.
const iOSDeepLink = params['deep_link_id']
? decodeURIComponent(params['deep_link_id'])
: undefined;
const iOSDoubleDeepLink = searchParamsOrEmpty(iOSDeepLink)['link'];
return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;
}
/**
* Optimistically tries to get search params from a string, or else returns an
* empty search params object.
*/
function searchParamsOrEmpty(url) {
if (!(url === null || url === void 0 ? void 0 : url.includes('?'))) {
return {};
}
const [_, ...rest] = url.split('?');
return util.querystringDecode(rest.join('?'));
}
/**
* @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.
*/
/**
* How long to wait for the initial auth event before concluding no
* redirect pending
*/
const INITIAL_EVENT_TIMEOUT_MS = 500;
class CordovaPopupRedirectResolver {
constructor() {
this._redirectPersistence = index.browserSessionPersistence;
this._shouldInitProactively = true; // This is lightweight for Cordova
this.eventManagers = new Map();
this.originValidationPromises = {};
this._completeRedirectFn = index._getRedirectResult;
this._overrideRedirectResult = index._overrideRedirectResult;
}
async _initialize(auth) {
const key = auth._key();
let manager = this.eventManagers.get(key);
if (!manager) {
manager = new CordovaAuthEventManager(auth);
this.eventManagers.set(key, manager);
this.attachCallbackListeners(auth, manager);
}
return manager;
}
_openPopup(auth) {
index._fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
}
async _openRedirect(auth, provider, authType, eventId) {
_checkCordovaConfiguration(auth);
const manager = await this._initialize(auth);
await manager.initialized();
// Reset the persisted redirect states. This does not matter on Web where
// the redirect always blows away application state entirely. On Cordova,
// the app maintains control flow through the redirect.
manager.resetRedirect();
index._clearRedirectOutcomes();
await this._originValidation(auth);
const event = _generateNewEvent(auth, authType, eventId);
await _savePartialEvent(auth, event);
const url = await _generateHandlerUrl(auth, event, provider);
const iabRef = await _performRedirect(url);
return _waitForAppResume(auth, manager, iabRef);
}
_isIframeWebStorageSupported(_auth, _cb) {
throw new Error('Method not implemented.');
}
_originValidation(auth) {
const key = auth._key();
if (!this.originValidationPromises[key]) {
this.originValidationPromises[key] = _validateOrigin(auth);
}
return this.originValidationPromises[key];
}
attachCallbackListeners(auth, manager) {
// Get the global plugins
const { universalLinks, handleOpenURL, BuildInfo } = _cordovaWindow();
const noEventTimeout = setTimeout(async () => {
// We didn't see that initial event. Clear any pending object and
// dispatch no event
await _getAndRemoveEvent(auth);
manager.onEvent(generateNoEvent());
}, INITIAL_EVENT_TIMEOUT_MS);
const universalLinksCb = async (eventData) => {
// We have an event so we can clear the no event timeout
clearTimeout(noEventTimeout);
const partialEvent = await _getAndRemoveEvent(auth);
let finalEvent = null;
if (partialEvent && (eventData === null || eventData === void 0 ? void 0 : eventData['url'])) {
finalEvent = _eventFromPartialAndUrl(partialEvent, eventData['url']);
}
// If finalEvent is never filled, trigger with no event
manager.onEvent(finalEvent || generateNoEvent());
};
// Universal links subscriber doesn't exist for iOS, so we need to check
if (typeof universalLinks !== 'undefined' &&
typeof universalLinks.subscribe === 'function') {
universalLinks.subscribe(null, universalLinksCb);
}
// iOS 7 or 8 custom URL schemes.
// This is also the current default behavior for iOS 9+.
// For this to work, cordova-plugin-customurlscheme needs to be installed.
// https://github.com/EddyVerbruggen/Custom-URL-scheme
// Do not overwrite the existing developer's URL handler.
const existingHandleOpenURL = handleOpenURL;
const packagePrefix = `${BuildInfo.packageName.toLowerCase()}://`;
_cordovaWindow().handleOpenURL = async (url) => {
if (url.toLowerCase().startsWith(packagePrefix)) {
// We want this intentionally to float
// eslint-disable-next-line @typescript-eslint/no-floating-promises
universalLinksCb({ url });
}
// Call the developer's handler if it is present.
if (typeof existingHandleOpenURL === 'function') {
try {
existingHandleOpenURL(url);
}
catch (e) {
// This is a developer error. Don't stop the flow of the SDK.
console.error(e);
}
}
};
}
}
/**
* An implementation of {@link PopupRedirectResolver} suitable for Cordova
* based applications.
*
* @public
*/
const cordovaPopupRedirectResolver = CordovaPopupRedirectResolver;
function generateNoEvent() {
return {
type: "unknown" /* AuthEventType.UNKNOWN */,
eventId: null,
sessionId: null,
urlResponse: null,
postBody: null,
tenantId: null,
error: index._createError("no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */)
};
}
/**
* @license
* Copyright 2017 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.
*/
// This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage.
// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it out
// of autogenerated documentation pages to reduce accidental misuse.
function addFrameworkForLogging(auth, framework) {
index._castAuth(auth)._logFramework(framework);
}
exports.ActionCodeOperation = index.ActionCodeOperation;
exports.ActionCodeURL = index.ActionCodeURL;
exports.AuthCredential = index.AuthCredential;
exports.AuthErrorCodes = index.AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY;
exports.AuthImpl = index.AuthImpl;
exports.AuthPopup = index.AuthPopup;
exports.EmailAuthCredential = index.EmailAuthCredential;
exports.EmailAuthProvider = index.EmailAuthProvider;
exports.FacebookAuthProvider = index.FacebookAuthProvider;
exports.FactorId = index.FactorId;
exports.FetchProvider = index.FetchProvider;
exports.GithubAuthProvider = index.GithubAuthProvider;
exports.GoogleAuthProvider = index.GoogleAuthProvider;
exports.OAuthCredential = index.OAuthCredential;
exports.OAuthProvider = index.OAuthProvider;
exports.OperationType = index.OperationType;
exports.PhoneAuthCredential = index.PhoneAuthCredential;
exports.PhoneAuthProvider = index.PhoneAuthProvider;
exports.PhoneMultiFactorGenerator = index.PhoneMultiFactorGenerator;
exports.ProviderId = index.ProviderId;
exports.RecaptchaVerifier = index.RecaptchaVerifier;
exports.SAMLAuthCredential = index.SAMLAuthCredential;
exports.SAMLAuthProvider = index.SAMLAuthProvider;
exports.SignInMethod = index.SignInMethod;
exports.TotpMultiFactorGenerator = index.TotpMultiFactorGenerator;
exports.TotpSecret = index.TotpSecret;
exports.TwitterAuthProvider = index.TwitterAuthProvider;
exports.UserImpl = index.UserImpl;
exports._assert = index._assert;
exports._castAuth = index._castAuth;
exports._fail = index._fail;
exports._generateEventId = index._generateEventId;
exports._getClientVersion = index._getClientVersion;
exports._getInstance = index._getInstance;
exports._getRedirectResult = index._getRedirectResult;
exports._overrideRedirectResult = index._overrideRedirectResult;
exports._persistenceKeyName = index._persistenceKeyName;
exports.applyActionCode = index.applyActionCode;
exports.beforeAuthStateChanged = index.beforeAuthStateChanged;
exports.browserLocalPersistence = index.browserLocalPersistence;
exports.browserPopupRedirectResolver = index.browserPopupRedirectResolver;
exports.browserSessionPersistence = index.browserSessionPersistence;
exports.checkActionCode = index.checkActionCode;
exports.confirmPasswordReset = index.confirmPasswordReset;
exports.connectAuthEmulator = index.connectAuthEmulator;
exports.createUserWithEmailAndPassword = index.createUserWithEmailAndPassword;
exports.debugErrorMap = index.debugErrorMap;
exports.deleteUser = index.deleteUser;
exports.fetchSignInMethodsForEmail = index.fetchSignInMethodsForEmail;
exports.getAdditionalUserInfo = index.getAdditionalUserInfo;
exports.getAuth = index.getAuth;
exports.getIdToken = index.getIdToken;
exports.getIdTokenResult = index.getIdTokenResult;
exports.getMultiFactorResolver = index.getMultiFactorResolver;
exports.getRedirectResult = index.getRedirectResult;
exports.inMemoryPersistence = index.inMemoryPersistence;
exports.indexedDBLocalPersistence = index.indexedDBLocalPersistence;
exports.initializeAuth = index.initializeAuth;
exports.initializeRecaptchaConfig = index.initializeRecaptchaConfig;
exports.isSignInWithEmailLink = index.isSignInWithEmailLink;
exports.linkWithCredential = index.linkWithCredential;
exports.linkWithPhoneNumber = index.linkWithPhoneNumber;
exports.linkWithPopup = index.linkWithPopup;
exports.linkWithRedirect = index.linkWithRedirect;
exports.multiFactor = index.multiFactor;
exports.onAuthStateChanged = index.onAuthStateChanged;
exports.onIdTokenChanged = index.onIdTokenChanged;
exports.parseActionCodeURL = index.parseActionCodeURL;
exports.prodErrorMap = index.prodErrorMap;
exports.reauthenticateWithCredential = index.reauthenticateWithCredential;
exports.reauthenticateWithPhoneNumber = index.reauthenticateWithPhoneNumber;
exports.reauthenticateWithPopup = index.reauthenticateWithPopup;
exports.reauthenticateWithRedirect = index.reauthenticateWithRedirect;
exports.reload = index.reload;
exports.revokeAccessToken = index.revokeAccessToken;
exports.sendEmailVerification = index.sendEmailVerification;
exports.sendPasswordResetEmail = index.sendPasswordResetEmail;
exports.sendSignInLinkToEmail = index.sendSignInLinkToEmail;
exports.setPersistence = index.setPersistence;
exports.signInAnonymously = index.signInAnonymously;
exports.signInWithCredential = index.signInWithCredential;
exports.signInWithCustomToken = index.signInWithCustomToken;
exports.signInWithEmailAndPassword = index.signInWithEmailAndPassword;
exports.signInWithEmailLink = index.signInWithEmailLink;
exports.signInWithPhoneNumber = index.signInWithPhoneNumber;
exports.signInWithPopup = index.signInWithPopup;
exports.signInWithRedirect = index.signInWithRedirect;
exports.signOut = index.signOut;
exports.unlink = index.unlink;
exports.updateCurrentUser = index.updateCurrentUser;
exports.updateEmail = index.updateEmail;
exports.updatePassword = index.updatePassword;
exports.updatePhoneNumber = index.updatePhoneNumber;
exports.updateProfile = index.updateProfile;
exports.useDeviceLanguage = index.useDeviceLanguage;
exports.validatePassword = index.validatePassword;
exports.verifyBeforeUpdateEmail = index.verifyBeforeUpdateEmail;
exports.verifyPasswordResetCode = index.verifyPasswordResetCode;
exports.addFrameworkForLogging = addFrameworkForLogging;
exports.cordovaPopupRedirectResolver = cordovaPopupRedirectResolver;
//# sourceMappingURL=internal.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,42 @@
/**
* @license
* Copyright 2017 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 { Auth } from '../src/model/public_types';
/**
* This interface is intended only for use by @firebase/auth-compat, do not use directly
*/
export * from '../index';
export { SignInWithIdpResponse } from '../src/api/authentication/idp';
export { AuthErrorCode } from '../src/core/errors';
export { PersistenceInternal } from '../src/core/persistence';
export { _persistenceKeyName } from '../src/core/persistence/persistence_user_manager';
export { UserImpl } from '../src/core/user/user_impl';
export { _getInstance } from '../src/core/util/instantiator';
export { PopupRedirectResolverInternal, EventManager, AuthEventType } from '../src/model/popup_redirect';
export { UserCredentialInternal, UserParameters } from '../src/model/user';
export { AuthInternal, ConfigInternal } from '../src/model/auth';
export { DefaultConfig, AuthImpl, _castAuth } from '../src/core/auth/auth_impl';
export { ClientPlatform, _getClientVersion } from '../src/core/util/version';
export { _generateEventId } from '../src/core/util/event_id';
export { TaggedWithTokenResponse } from '../src/model/id_token';
export { _fail, _assert } from '../src/core/util/assert';
export { AuthPopup } from '../src/platform_browser/util/popup';
export { _getRedirectResult } from '../src/platform_browser/strategies/redirect';
export { _overrideRedirectResult } from '../src/core/strategies/redirect';
export { cordovaPopupRedirectResolver } from '../src/platform_cordova/popup_redirect/popup_redirect';
export { FetchProvider } from '../src/core/util/fetch_provider';
export { SAMLAuthCredential } from '../src/core/credentials/saml';
export declare function addFrameworkForLogging(auth: Auth, framework: string): void;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,59 @@
/**
* @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 { MfaEnrollment } from './mfa';
import { Auth } from '../../model/public_types';
export interface DeleteAccountRequest {
idToken: string;
}
export declare function deleteAccount(auth: Auth, request: DeleteAccountRequest): Promise<void>;
export interface ProviderUserInfo {
providerId: string;
rawId?: string;
email?: string;
displayName?: string;
photoUrl?: string;
phoneNumber?: string;
}
export interface DeleteLinkedAccountsRequest {
idToken: string;
deleteProvider: string[];
}
export interface DeleteLinkedAccountsResponse {
providerUserInfo: ProviderUserInfo[];
}
export declare function deleteLinkedAccounts(auth: Auth, request: DeleteLinkedAccountsRequest): Promise<DeleteLinkedAccountsResponse>;
export interface APIUserInfo {
localId?: string;
displayName?: string;
photoUrl?: string;
email?: string;
emailVerified?: boolean;
phoneNumber?: string;
lastLoginAt?: number;
createdAt?: number;
tenantId?: string;
passwordHash?: string;
providerUserInfo?: ProviderUserInfo[];
mfaInfo?: MfaEnrollment[];
}
export interface GetAccountInfoRequest {
idToken: string;
}
export interface GetAccountInfoResponse {
users: APIUserInfo[];
}
export declare function getAccountInfo(auth: Auth, request: GetAccountInfoRequest): Promise<GetAccountInfoResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,49 @@
/**
* @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 { ActionCodeOperation, Auth } from '../../model/public_types';
import { IdTokenResponse } from '../../model/id_token';
import { MfaEnrollment } from './mfa';
import { SignUpRequest, SignUpResponse } from '../authentication/sign_up';
export interface ResetPasswordRequest {
oobCode: string;
newPassword?: string;
tenantId?: string;
}
export interface ResetPasswordResponse {
email: string;
newEmail?: string;
requestType?: ActionCodeOperation;
mfaInfo?: MfaEnrollment;
}
export declare function resetPassword(auth: Auth, request: ResetPasswordRequest): Promise<ResetPasswordResponse>;
export interface UpdateEmailPasswordRequest {
idToken: string;
returnSecureToken?: boolean;
email?: string;
password?: string;
}
export interface UpdateEmailPasswordResponse extends IdTokenResponse {
}
export declare function updateEmailPassword(auth: Auth, request: UpdateEmailPasswordRequest): Promise<UpdateEmailPasswordResponse>;
export declare function linkEmailPassword(auth: Auth, request: SignUpRequest): Promise<SignUpResponse>;
export interface ApplyActionCodeRequest {
oobCode: string;
tenantId?: string;
}
export interface ApplyActionCodeResponse {
}
export declare function applyActionCode(auth: Auth, request: ApplyActionCodeRequest): Promise<ApplyActionCodeResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,107 @@
/**
* @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 { RecaptchaClientType, RecaptchaVersion } from '../index';
import { SignInWithPhoneNumberRequest } from '../authentication/sms';
import { FinalizeMfaResponse } from '../authentication/mfa';
import { AuthInternal } from '../../model/auth';
/**
* MFA Info as returned by the API.
*/
interface BaseMfaEnrollment {
mfaEnrollmentId: string;
enrolledAt: number;
displayName?: string;
}
/**
* An MFA provided by SMS verification.
*/
export interface PhoneMfaEnrollment extends BaseMfaEnrollment {
phoneInfo: string;
}
/**
* An MFA provided by TOTP (Time-based One Time Password).
*/
export interface TotpMfaEnrollment extends BaseMfaEnrollment {
}
/**
* MfaEnrollment can be any subtype of BaseMfaEnrollment, currently only PhoneMfaEnrollment and TotpMfaEnrollment are supported.
*/
export declare type MfaEnrollment = PhoneMfaEnrollment | TotpMfaEnrollment;
export interface StartPhoneMfaEnrollmentRequest {
idToken: string;
phoneEnrollmentInfo: {
phoneNumber: string;
recaptchaToken?: string;
captchaResponse?: string;
clientType?: RecaptchaClientType;
recaptchaVersion?: RecaptchaVersion;
};
tenantId?: string;
}
export interface StartPhoneMfaEnrollmentResponse {
phoneSessionInfo: {
sessionInfo: string;
};
}
export declare function startEnrollPhoneMfa(auth: AuthInternal, request: StartPhoneMfaEnrollmentRequest): Promise<StartPhoneMfaEnrollmentResponse>;
export interface FinalizePhoneMfaEnrollmentRequest {
idToken: string;
phoneVerificationInfo: SignInWithPhoneNumberRequest;
displayName?: string | null;
tenantId?: string;
}
export interface FinalizePhoneMfaEnrollmentResponse extends FinalizeMfaResponse {
}
export declare function finalizeEnrollPhoneMfa(auth: AuthInternal, request: FinalizePhoneMfaEnrollmentRequest): Promise<FinalizePhoneMfaEnrollmentResponse>;
export interface StartTotpMfaEnrollmentRequest {
idToken: string;
totpEnrollmentInfo: {};
tenantId?: string;
}
export interface StartTotpMfaEnrollmentResponse {
totpSessionInfo: {
sharedSecretKey: string;
verificationCodeLength: number;
hashingAlgorithm: string;
periodSec: number;
sessionInfo: string;
finalizeEnrollmentTime: number;
};
}
export declare function startEnrollTotpMfa(auth: AuthInternal, request: StartTotpMfaEnrollmentRequest): Promise<StartTotpMfaEnrollmentResponse>;
export interface TotpVerificationInfo {
sessionInfo: string;
verificationCode: string;
}
export interface FinalizeTotpMfaEnrollmentRequest {
idToken: string;
totpVerificationInfo: TotpVerificationInfo;
displayName?: string | null;
tenantId?: string;
}
export interface FinalizeTotpMfaEnrollmentResponse extends FinalizeMfaResponse {
}
export declare function finalizeEnrollTotpMfa(auth: AuthInternal, request: FinalizeTotpMfaEnrollmentRequest): Promise<FinalizeTotpMfaEnrollmentResponse>;
export interface WithdrawMfaRequest {
idToken: string;
mfaEnrollmentId: string;
tenantId?: string;
}
export interface WithdrawMfaResponse extends FinalizeMfaResponse {
}
export declare function withdrawMfa(auth: AuthInternal, request: WithdrawMfaRequest): Promise<WithdrawMfaResponse>;
export {};

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,29 @@
/**
* @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 { IdTokenResponse } from '../../model/id_token';
import { Auth } from '../../model/public_types';
export interface UpdateProfileRequest {
idToken: string;
displayName?: string | null;
photoUrl?: string | null;
returnSecureToken: boolean;
}
export interface UpdateProfileResponse extends IdTokenResponse {
displayName?: string | null;
photoUrl?: string | null;
}
export declare function updateProfile(auth: Auth, request: UpdateProfileRequest): Promise<UpdateProfileResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,26 @@
/**
* @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 { Auth } from '../../model/public_types';
export interface CreateAuthUriRequest {
identifier: string;
continueUri: string;
tenantId?: string;
}
export interface CreateAuthUriResponse {
signinMethods: string[];
}
export declare function createAuthUri(auth: Auth, request: CreateAuthUriRequest): Promise<CreateAuthUriResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,26 @@
/**
* @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 { IdTokenResponse } from '../../model/id_token';
import { Auth } from '../../model/public_types';
export interface SignInWithCustomTokenRequest {
token: string;
returnSecureToken: boolean;
tenantId?: string;
}
export interface SignInWithCustomTokenResponse extends IdTokenResponse {
}
export declare function signInWithCustomToken(auth: Auth, request: SignInWithCustomTokenRequest): Promise<SignInWithCustomTokenResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,85 @@
/**
* @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 { ActionCodeOperation, Auth } from '../../model/public_types';
import { RecaptchaClientType, RecaptchaVersion } from '../index';
import { IdToken, IdTokenResponse } from '../../model/id_token';
export interface SignInWithPasswordRequest {
returnSecureToken?: boolean;
email: string;
password: string;
tenantId?: string;
captchaResponse?: string;
clientType?: RecaptchaClientType;
recaptchaVersion?: RecaptchaVersion;
}
export interface SignInWithPasswordResponse extends IdTokenResponse {
email: string;
displayName: string;
}
export declare function signInWithPassword(auth: Auth, request: SignInWithPasswordRequest): Promise<SignInWithPasswordResponse>;
export interface GetOobCodeRequest {
email?: string;
continueUrl?: string;
iOSBundleId?: string;
iosAppStoreId?: string;
androidPackageName?: string;
androidInstallApp?: boolean;
androidMinimumVersionCode?: string;
canHandleCodeInApp?: boolean;
dynamicLinkDomain?: string;
tenantId?: string;
targetProjectid?: string;
}
export interface VerifyEmailRequest extends GetOobCodeRequest {
requestType: ActionCodeOperation.VERIFY_EMAIL;
idToken: IdToken;
}
export interface PasswordResetRequest extends GetOobCodeRequest {
requestType: ActionCodeOperation.PASSWORD_RESET;
email: string;
captchaResp?: string;
clientType?: RecaptchaClientType;
recaptchaVersion?: RecaptchaVersion;
}
export interface EmailSignInRequest extends GetOobCodeRequest {
requestType: ActionCodeOperation.EMAIL_SIGNIN;
email: string;
captchaResp?: string;
clientType?: RecaptchaClientType;
recaptchaVersion?: RecaptchaVersion;
}
export interface VerifyAndChangeEmailRequest extends GetOobCodeRequest {
requestType: ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL;
idToken: IdToken;
newEmail: string;
}
interface GetOobCodeResponse {
email: string;
}
export interface VerifyEmailResponse extends GetOobCodeResponse {
}
export interface PasswordResetResponse extends GetOobCodeResponse {
}
export interface EmailSignInResponse extends GetOobCodeResponse {
}
export interface VerifyAndChangeEmailResponse extends GetOobCodeRequest {
}
export declare function sendEmailVerification(auth: Auth, request: VerifyEmailRequest): Promise<VerifyEmailResponse>;
export declare function sendPasswordResetEmail(auth: Auth, request: PasswordResetRequest): Promise<PasswordResetResponse>;
export declare function sendSignInLinkToEmail(auth: Auth, request: EmailSignInRequest): Promise<EmailSignInResponse>;
export declare function verifyAndChangeEmail(auth: Auth, request: VerifyAndChangeEmailRequest): Promise<VerifyAndChangeEmailResponse>;
export {};

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,32 @@
/**
* @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 { IdTokenResponse } from '../../model/id_token';
import { Auth } from '../../model/public_types';
export interface SignInWithEmailLinkRequest {
email: string;
oobCode: string;
tenantId?: string;
}
export interface SignInWithEmailLinkResponse extends IdTokenResponse {
email: string;
isNewUser: boolean;
}
export declare function signInWithEmailLink(auth: Auth, request: SignInWithEmailLinkRequest): Promise<SignInWithEmailLinkResponse>;
export interface SignInWithEmailLinkForLinkingRequest extends SignInWithEmailLinkRequest {
idToken: string;
}
export declare function signInWithEmailLinkForLinking(auth: Auth, request: SignInWithEmailLinkForLinkingRequest): Promise<SignInWithEmailLinkResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,40 @@
/**
* @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 { IdToken, IdTokenResponse } from '../../model/id_token';
import { Auth } from '../../model/public_types';
export interface SignInWithIdpRequest {
requestUri: string;
postBody?: string;
sessionId?: string;
tenantId?: string;
returnSecureToken: boolean;
returnIdpCredential?: boolean;
idToken?: IdToken;
autoCreate?: boolean;
pendingToken?: string;
}
/**
* @internal
*/
export interface SignInWithIdpResponse extends IdTokenResponse {
oauthAccessToken?: string;
oauthTokenSecret?: string;
nonce?: string;
oauthIdToken?: string;
pendingToken?: string;
}
export declare function signInWithIdp(auth: Auth, request: SignInWithIdpRequest): Promise<SignInWithIdpResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,73 @@
/**
* @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 { RecaptchaClientType, RecaptchaVersion } from '../index';
import { Auth } from '../../model/public_types';
import { IdTokenResponse } from '../../model/id_token';
import { MfaEnrollment } from '../account_management/mfa';
import { SignInWithIdpResponse } from './idp';
import { SignInWithPhoneNumberRequest, SignInWithPhoneNumberResponse } from './sms';
export interface FinalizeMfaResponse {
idToken: string;
refreshToken: string;
}
/**
* @internal
*/
export interface IdTokenMfaResponse extends IdTokenResponse {
mfaPendingCredential?: string;
mfaInfo?: MfaEnrollment[];
}
export interface StartPhoneMfaSignInRequest {
mfaPendingCredential: string;
mfaEnrollmentId: string;
phoneSignInInfo: {
recaptchaToken?: string;
captchaResponse?: string;
clientType?: RecaptchaClientType;
recaptchaVersion?: RecaptchaVersion;
};
tenantId?: string;
}
export interface StartPhoneMfaSignInResponse {
phoneResponseInfo: {
sessionInfo: string;
};
}
export declare function startSignInPhoneMfa(auth: Auth, request: StartPhoneMfaSignInRequest): Promise<StartPhoneMfaSignInResponse>;
export interface FinalizePhoneMfaSignInRequest {
mfaPendingCredential: string;
phoneVerificationInfo: SignInWithPhoneNumberRequest;
tenantId?: string;
}
export interface FinalizeTotpMfaSignInRequest {
mfaPendingCredential: string;
totpVerificationInfo: {
verificationCode: string;
};
tenantId?: string;
mfaEnrollmentId: string;
}
export interface FinalizePhoneMfaSignInResponse extends FinalizeMfaResponse {
}
export interface FinalizeTotpMfaSignInResponse extends FinalizeMfaResponse {
}
export declare function finalizeSignInPhoneMfa(auth: Auth, request: FinalizePhoneMfaSignInRequest): Promise<FinalizePhoneMfaSignInResponse>;
export declare function finalizeSignInTotpMfa(auth: Auth, request: FinalizeTotpMfaSignInRequest): Promise<FinalizeTotpMfaSignInResponse>;
/**
* @internal
*/
export declare type PhoneOrOauthTokenResponse = SignInWithPhoneNumberResponse | SignInWithIdpResponse | IdTokenResponse;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,34 @@
/**
* @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 { RecaptchaClientType, RecaptchaVersion } from '../index';
import { Auth } from '../../model/public_types';
export declare function getRecaptchaParams(auth: Auth): Promise<string>;
interface GetRecaptchaConfigRequest {
tenantId?: string;
clientType?: RecaptchaClientType;
version?: RecaptchaVersion;
}
export interface RecaptchaEnforcementProviderState {
provider: string;
enforcementState: string;
}
export interface GetRecaptchaConfigResponse {
recaptchaKey: string;
recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
}
export declare function getRecaptchaConfig(auth: Auth, request: GetRecaptchaConfigRequest): Promise<GetRecaptchaConfigResponse>;
export {};

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,34 @@
/**
* @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 { RecaptchaClientType, RecaptchaVersion } from '../index';
import { IdTokenResponse } from '../../model/id_token';
import { Auth } from '../../model/public_types';
export interface SignUpRequest {
idToken?: string;
returnSecureToken?: boolean;
email?: string;
password?: string;
tenantId?: string;
captchaResponse?: string;
clientType?: RecaptchaClientType;
recaptchaVersion?: RecaptchaVersion;
}
export interface SignUpResponse extends IdTokenResponse {
displayName?: string;
email?: string;
}
export declare function signUp(auth: Auth, request: SignUpRequest): Promise<SignUpResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,54 @@
/**
* @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 { RecaptchaClientType, RecaptchaVersion } from '../index';
import { IdTokenResponse } from '../../model/id_token';
import { Auth } from '../../model/public_types';
export interface SendPhoneVerificationCodeRequest {
phoneNumber: string;
recaptchaToken?: string;
tenantId?: string;
captchaResponse?: string;
clientType?: RecaptchaClientType;
recaptchaVersion?: RecaptchaVersion;
}
export interface SendPhoneVerificationCodeResponse {
sessionInfo: string;
}
export declare function sendPhoneVerificationCode(auth: Auth, request: SendPhoneVerificationCodeRequest): Promise<SendPhoneVerificationCodeResponse>;
/**
* @internal
*/
export interface SignInWithPhoneNumberRequest {
temporaryProof?: string;
phoneNumber?: string;
sessionInfo?: string;
code?: string;
tenantId?: string;
}
export interface LinkWithPhoneNumberRequest extends SignInWithPhoneNumberRequest {
idToken: string;
}
/**
* @internal
*/
export interface SignInWithPhoneNumberResponse extends IdTokenResponse {
temporaryProof?: string;
phoneNumber?: string;
}
export declare function signInWithPhoneNumber(auth: Auth, request: SignInWithPhoneNumberRequest): Promise<SignInWithPhoneNumberResponse>;
export declare function linkWithPhoneNumber(auth: Auth, request: LinkWithPhoneNumberRequest): Promise<SignInWithPhoneNumberResponse>;
export declare function verifyPhoneNumberForExisting(auth: Auth, request: SignInWithPhoneNumberRequest): Promise<SignInWithPhoneNumberResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,37 @@
/**
* @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 { Auth } from '../../model/public_types';
export declare const enum TokenType {
REFRESH_TOKEN = "REFRESH_TOKEN",
ACCESS_TOKEN = "ACCESS_TOKEN"
}
export interface RequestStsTokenResponse {
accessToken: string;
expiresIn: string;
refreshToken: string;
}
export interface RevokeTokenRequest {
providerId: string;
tokenType: TokenType;
token: string;
idToken: string;
tenantId?: string;
}
export interface RevokeTokenResponse {
}
export declare function requestStsToken(auth: Auth, refreshToken: string): Promise<RequestStsTokenResponse>;
export declare function revokeToken(auth: Auth, request: RevokeTokenRequest): Promise<RevokeTokenResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,128 @@
/**
* @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 { AuthErrorCode } from '../core/errors';
/**
* Errors that can be returned by the backend
*/
export declare const enum ServerError {
ADMIN_ONLY_OPERATION = "ADMIN_ONLY_OPERATION",
BLOCKING_FUNCTION_ERROR_RESPONSE = "BLOCKING_FUNCTION_ERROR_RESPONSE",
CAPTCHA_CHECK_FAILED = "CAPTCHA_CHECK_FAILED",
CORS_UNSUPPORTED = "CORS_UNSUPPORTED",
CREDENTIAL_MISMATCH = "CREDENTIAL_MISMATCH",
CREDENTIAL_TOO_OLD_LOGIN_AGAIN = "CREDENTIAL_TOO_OLD_LOGIN_AGAIN",
DYNAMIC_LINK_NOT_ACTIVATED = "DYNAMIC_LINK_NOT_ACTIVATED",
EMAIL_CHANGE_NEEDS_VERIFICATION = "EMAIL_CHANGE_NEEDS_VERIFICATION",
EMAIL_EXISTS = "EMAIL_EXISTS",
EMAIL_NOT_FOUND = "EMAIL_NOT_FOUND",
EXPIRED_OOB_CODE = "EXPIRED_OOB_CODE",
FEDERATED_USER_ID_ALREADY_LINKED = "FEDERATED_USER_ID_ALREADY_LINKED",
INVALID_APP_CREDENTIAL = "INVALID_APP_CREDENTIAL",
INVALID_APP_ID = "INVALID_APP_ID",
INVALID_CERT_HASH = "INVALID_CERT_HASH",
INVALID_CODE = "INVALID_CODE",
INVALID_CONTINUE_URI = "INVALID_CONTINUE_URI",
INVALID_CUSTOM_TOKEN = "INVALID_CUSTOM_TOKEN",
INVALID_DYNAMIC_LINK_DOMAIN = "INVALID_DYNAMIC_LINK_DOMAIN",
INVALID_EMAIL = "INVALID_EMAIL",
INVALID_ID_TOKEN = "INVALID_ID_TOKEN",
INVALID_IDP_RESPONSE = "INVALID_IDP_RESPONSE",
INVALID_IDENTIFIER = "INVALID_IDENTIFIER",
INVALID_LOGIN_CREDENTIALS = "INVALID_LOGIN_CREDENTIALS",
INVALID_MESSAGE_PAYLOAD = "INVALID_MESSAGE_PAYLOAD",
INVALID_MFA_PENDING_CREDENTIAL = "INVALID_MFA_PENDING_CREDENTIAL",
INVALID_OAUTH_CLIENT_ID = "INVALID_OAUTH_CLIENT_ID",
INVALID_OOB_CODE = "INVALID_OOB_CODE",
INVALID_PASSWORD = "INVALID_PASSWORD",
INVALID_PENDING_TOKEN = "INVALID_PENDING_TOKEN",
INVALID_PHONE_NUMBER = "INVALID_PHONE_NUMBER",
INVALID_PROVIDER_ID = "INVALID_PROVIDER_ID",
INVALID_RECIPIENT_EMAIL = "INVALID_RECIPIENT_EMAIL",
INVALID_SENDER = "INVALID_SENDER",
INVALID_SESSION_INFO = "INVALID_SESSION_INFO",
INVALID_TEMPORARY_PROOF = "INVALID_TEMPORARY_PROOF",
INVALID_TENANT_ID = "INVALID_TENANT_ID",
MFA_ENROLLMENT_NOT_FOUND = "MFA_ENROLLMENT_NOT_FOUND",
MISSING_ANDROID_PACKAGE_NAME = "MISSING_ANDROID_PACKAGE_NAME",
MISSING_APP_CREDENTIAL = "MISSING_APP_CREDENTIAL",
MISSING_CODE = "MISSING_CODE",
MISSING_CONTINUE_URI = "MISSING_CONTINUE_URI",
MISSING_CUSTOM_TOKEN = "MISSING_CUSTOM_TOKEN",
MISSING_IOS_BUNDLE_ID = "MISSING_IOS_BUNDLE_ID",
MISSING_MFA_ENROLLMENT_ID = "MISSING_MFA_ENROLLMENT_ID",
MISSING_MFA_PENDING_CREDENTIAL = "MISSING_MFA_PENDING_CREDENTIAL",
MISSING_OOB_CODE = "MISSING_OOB_CODE",
MISSING_OR_INVALID_NONCE = "MISSING_OR_INVALID_NONCE",
MISSING_PASSWORD = "MISSING_PASSWORD",
MISSING_REQ_TYPE = "MISSING_REQ_TYPE",
MISSING_PHONE_NUMBER = "MISSING_PHONE_NUMBER",
MISSING_SESSION_INFO = "MISSING_SESSION_INFO",
OPERATION_NOT_ALLOWED = "OPERATION_NOT_ALLOWED",
PASSWORD_LOGIN_DISABLED = "PASSWORD_LOGIN_DISABLED",
QUOTA_EXCEEDED = "QUOTA_EXCEEDED",
RESET_PASSWORD_EXCEED_LIMIT = "RESET_PASSWORD_EXCEED_LIMIT",
REJECTED_CREDENTIAL = "REJECTED_CREDENTIAL",
SECOND_FACTOR_EXISTS = "SECOND_FACTOR_EXISTS",
SECOND_FACTOR_LIMIT_EXCEEDED = "SECOND_FACTOR_LIMIT_EXCEEDED",
SESSION_EXPIRED = "SESSION_EXPIRED",
TENANT_ID_MISMATCH = "TENANT_ID_MISMATCH",
TOKEN_EXPIRED = "TOKEN_EXPIRED",
TOO_MANY_ATTEMPTS_TRY_LATER = "TOO_MANY_ATTEMPTS_TRY_LATER",
UNSUPPORTED_FIRST_FACTOR = "UNSUPPORTED_FIRST_FACTOR",
UNSUPPORTED_TENANT_OPERATION = "UNSUPPORTED_TENANT_OPERATION",
UNAUTHORIZED_DOMAIN = "UNAUTHORIZED_DOMAIN",
UNVERIFIED_EMAIL = "UNVERIFIED_EMAIL",
USER_CANCELLED = "USER_CANCELLED",
USER_DISABLED = "USER_DISABLED",
USER_NOT_FOUND = "USER_NOT_FOUND",
WEAK_PASSWORD = "WEAK_PASSWORD",
RECAPTCHA_NOT_ENABLED = "RECAPTCHA_NOT_ENABLED",
MISSING_RECAPTCHA_TOKEN = "MISSING_RECAPTCHA_TOKEN",
INVALID_RECAPTCHA_TOKEN = "INVALID_RECAPTCHA_TOKEN",
INVALID_RECAPTCHA_ACTION = "INVALID_RECAPTCHA_ACTION",
MISSING_CLIENT_TYPE = "MISSING_CLIENT_TYPE",
MISSING_RECAPTCHA_VERSION = "MISSING_RECAPTCHA_VERSION",
INVALID_RECAPTCHA_VERSION = "INVALID_RECAPTCHA_VERSION",
INVALID_REQ_TYPE = "INVALID_REQ_TYPE",
PASSWORD_DOES_NOT_MEET_REQUIREMENTS = "PASSWORD_DOES_NOT_MEET_REQUIREMENTS"
}
/**
* API Response in the event of an error
*/
export interface JsonError {
error: {
code: number;
message: string;
errors?: [
{
message: ServerError;
domain: string;
reason: string;
}
];
};
}
/**
* Type definition for a map from server errors to developer visible errors
*/
export declare type ServerErrorMap<ApiError extends string> = {
readonly [K in ApiError]: AuthErrorCode;
};
/**
* Map from errors returned by the server to errors to developer visible errors
*/
export declare const SERVER_ERROR_MAP: Partial<ServerErrorMap<ServerError>>;

View file

@ -0,0 +1,101 @@
/**
* @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 { FirebaseError } from '@firebase/util';
import { AuthErrorCode } from '../core/errors';
import { Delay } from '../core/util/delay';
import { Auth } from '../model/public_types';
import { IdTokenResponse } from '../model/id_token';
import { ServerError, ServerErrorMap } from './errors';
export declare const enum HttpMethod {
POST = "POST",
GET = "GET"
}
export declare const enum HttpHeader {
CONTENT_TYPE = "Content-Type",
X_FIREBASE_LOCALE = "X-Firebase-Locale",
X_CLIENT_VERSION = "X-Client-Version",
X_FIREBASE_GMPID = "X-Firebase-gmpid",
X_FIREBASE_CLIENT = "X-Firebase-Client",
X_FIREBASE_APP_CHECK = "X-Firebase-AppCheck"
}
export declare const enum Endpoint {
CREATE_AUTH_URI = "/v1/accounts:createAuthUri",
DELETE_ACCOUNT = "/v1/accounts:delete",
RESET_PASSWORD = "/v1/accounts:resetPassword",
SIGN_UP = "/v1/accounts:signUp",
SIGN_IN_WITH_CUSTOM_TOKEN = "/v1/accounts:signInWithCustomToken",
SIGN_IN_WITH_EMAIL_LINK = "/v1/accounts:signInWithEmailLink",
SIGN_IN_WITH_IDP = "/v1/accounts:signInWithIdp",
SIGN_IN_WITH_PASSWORD = "/v1/accounts:signInWithPassword",
SIGN_IN_WITH_PHONE_NUMBER = "/v1/accounts:signInWithPhoneNumber",
SEND_VERIFICATION_CODE = "/v1/accounts:sendVerificationCode",
SEND_OOB_CODE = "/v1/accounts:sendOobCode",
SET_ACCOUNT_INFO = "/v1/accounts:update",
GET_ACCOUNT_INFO = "/v1/accounts:lookup",
GET_RECAPTCHA_PARAM = "/v1/recaptchaParams",
START_MFA_ENROLLMENT = "/v2/accounts/mfaEnrollment:start",
FINALIZE_MFA_ENROLLMENT = "/v2/accounts/mfaEnrollment:finalize",
START_MFA_SIGN_IN = "/v2/accounts/mfaSignIn:start",
FINALIZE_MFA_SIGN_IN = "/v2/accounts/mfaSignIn:finalize",
WITHDRAW_MFA = "/v2/accounts/mfaEnrollment:withdraw",
GET_PROJECT_CONFIG = "/v1/projects",
GET_RECAPTCHA_CONFIG = "/v2/recaptchaConfig",
GET_PASSWORD_POLICY = "/v2/passwordPolicy",
TOKEN = "/v1/token",
REVOKE_TOKEN = "/v2/accounts:revokeToken"
}
export declare const enum RecaptchaClientType {
WEB = "CLIENT_TYPE_WEB",
ANDROID = "CLIENT_TYPE_ANDROID",
IOS = "CLIENT_TYPE_IOS"
}
export declare const enum RecaptchaVersion {
ENTERPRISE = "RECAPTCHA_ENTERPRISE"
}
export declare const enum RecaptchaActionName {
SIGN_IN_WITH_PASSWORD = "signInWithPassword",
GET_OOB_CODE = "getOobCode",
SIGN_UP_PASSWORD = "signUpPassword",
SEND_VERIFICATION_CODE = "sendVerificationCode",
MFA_SMS_ENROLLMENT = "mfaSmsEnrollment",
MFA_SMS_SIGNIN = "mfaSmsSignIn"
}
export declare const enum EnforcementState {
ENFORCE = "ENFORCE",
AUDIT = "AUDIT",
OFF = "OFF",
ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED"
}
export declare const enum RecaptchaAuthProvider {
EMAIL_PASSWORD_PROVIDER = "EMAIL_PASSWORD_PROVIDER",
PHONE_PROVIDER = "PHONE_PROVIDER"
}
export declare const DEFAULT_API_TIMEOUT_MS: Delay;
export declare function _addTidIfNecessary<T extends {
tenantId?: string;
}>(auth: Auth, request: T): T;
export declare function _performApiRequest<T, V>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>;
export declare function _performFetchWithErrorHandling<V>(auth: Auth, customErrorMap: Partial<ServerErrorMap<ServerError>>, fetchFn: () => Promise<Response>): Promise<V>;
export declare function _performSignInRequest<T, V extends IdTokenResponse>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>;
export declare function _getFinalTarget(auth: Auth, host: string, path: string, query: string): string;
export declare function _parseEnforcementState(enforcementStateStr: string): EnforcementState;
interface PotentialResponse extends IdTokenResponse {
email?: string;
phoneNumber?: string;
}
export declare function _makeTaggedError(auth: Auth, code: AuthErrorCode, response: PotentialResponse): FirebaseError;
export {};

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,48 @@
/**
* @license
* Copyright 2023 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 { Auth } from '../../model/public_types';
/**
* Request object for fetching the password policy.
*/
export interface GetPasswordPolicyRequest {
tenantId?: string;
}
/**
* Response object for fetching the password policy.
*/
export interface GetPasswordPolicyResponse {
customStrengthOptions: {
minPasswordLength?: number;
maxPasswordLength?: number;
containsLowercaseCharacter?: boolean;
containsUppercaseCharacter?: boolean;
containsNumericCharacter?: boolean;
containsNonAlphanumericCharacter?: boolean;
};
allowedNonAlphanumericCharacters?: string[];
enforcementState: string;
forceUpgradeOnSignin?: boolean;
schemaVersion: number;
}
/**
* Fetches the password policy for the currently set tenant or the project if no tenant is set.
*
* @param auth Auth object.
* @param request Password policy request.
* @returns Password policy response.
*/
export declare function _getPasswordPolicy(auth: Auth, request?: GetPasswordPolicyRequest): Promise<GetPasswordPolicyResponse>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2023 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 {};

View file

@ -0,0 +1,25 @@
/**
* @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 { Auth } from '../../model/public_types';
export interface GetProjectConfigRequest {
androidPackageName?: string;
iosBundleId?: string;
}
export interface GetProjectConfigResponse {
authorizedDomains: string[];
}
export declare function _getProjectConfig(auth: Auth, request?: GetProjectConfigRequest): Promise<GetProjectConfigResponse>;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,73 @@
/**
* @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.
*/
/**
* A utility class to parse email action URLs such as password reset, email verification,
* email link sign in, etc.
*
* @public
*/
export declare class ActionCodeURL {
/**
* The API key of the email action link.
*/
readonly apiKey: string;
/**
* The action code of the email action link.
*/
readonly code: string;
/**
* The continue URL of the email action link. Null if not provided.
*/
readonly continueUrl: string | null;
/**
* The language code of the email action link. Null if not provided.
*/
readonly languageCode: string | null;
/**
* The action performed by the email action link. It returns from one of the types from
* {@link ActionCodeInfo}
*/
readonly operation: string;
/**
* The tenant ID of the email action link. Null if the email action is from the parent project.
*/
readonly tenantId: string | null;
/**
* @param actionLink - The link from which to extract the URL.
* @returns The {@link ActionCodeURL} object, or null if the link is invalid.
*
* @internal
*/
constructor(actionLink: string);
/**
* Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
* otherwise returns null.
*
* @param link - The email action link string.
* @returns The {@link ActionCodeURL} object, or null if the link is invalid.
*
* @public
*/
static parseLink(link: string): ActionCodeURL | null;
}
/**
* Parses the email action link string and returns an {@link ActionCodeURL} if
* the link is valid, otherwise returns null.
*
* @public
*/
export declare function parseActionCodeURL(link: string): ActionCodeURL | null;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,34 @@
/**
* @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 { AuthEvent, AuthEventConsumer, EventManager } from '../../model/popup_redirect';
import { AuthInternal } from '../../model/auth';
export declare class AuthEventManager implements EventManager {
private readonly auth;
private readonly cachedEventUids;
private readonly consumers;
protected queuedRedirectEvent: AuthEvent | null;
protected hasHandledPotentialRedirect: boolean;
private lastProcessedEventTime;
constructor(auth: AuthInternal);
registerConsumer(authEventConsumer: AuthEventConsumer): void;
unregisterConsumer(authEventConsumer: AuthEventConsumer): void;
onEvent(event: AuthEvent): boolean;
private sendToConsumer;
private isEventForConsumer;
private hasEventBeenHandled;
private saveEventToCache;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,130 @@
/**
* @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 { _FirebaseService, FirebaseApp } from '@firebase/app';
import { Provider } from '@firebase/component';
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { Auth, AuthErrorMap, AuthSettings, EmulatorConfig, NextOrObserver, Persistence, PopupRedirectResolver, User, CompleteFn, ErrorFn, Unsubscribe, PasswordValidationStatus } from '../../model/public_types';
import { ErrorFactory } from '@firebase/util';
import { AuthInternal, ConfigInternal } from '../../model/auth';
import { PopupRedirectResolverInternal } from '../../model/popup_redirect';
import { UserInternal } from '../../model/user';
import { AuthErrorCode, AuthErrorParams } from '../errors';
import { PersistenceInternal } from '../persistence';
import { RecaptchaConfig } from '../../platform_browser/recaptcha/recaptcha';
import { PasswordPolicyInternal } from '../../model/password_policy';
export declare const enum DefaultConfig {
TOKEN_API_HOST = "securetoken.googleapis.com",
API_HOST = "identitytoolkit.googleapis.com",
API_SCHEME = "https"
}
export declare class AuthImpl implements AuthInternal, _FirebaseService {
readonly app: FirebaseApp;
private readonly heartbeatServiceProvider;
private readonly appCheckServiceProvider;
readonly config: ConfigInternal;
currentUser: User | null;
emulatorConfig: EmulatorConfig | null;
private operations;
private persistenceManager?;
private redirectPersistenceManager?;
private authStateSubscription;
private idTokenSubscription;
private readonly beforeStateQueue;
private redirectUser;
private isProactiveRefreshEnabled;
private readonly EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION;
_canInitEmulator: boolean;
_isInitialized: boolean;
_deleted: boolean;
_initializationPromise: Promise<void> | null;
_popupRedirectResolver: PopupRedirectResolverInternal | null;
_errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>;
_agentRecaptchaConfig: RecaptchaConfig | null;
_tenantRecaptchaConfigs: Record<string, RecaptchaConfig>;
_projectPasswordPolicy: PasswordPolicyInternal | null;
_tenantPasswordPolicies: Record<string, PasswordPolicyInternal>;
readonly name: string;
private lastNotifiedUid;
languageCode: string | null;
tenantId: string | null;
settings: AuthSettings;
constructor(app: FirebaseApp, heartbeatServiceProvider: Provider<'heartbeat'>, appCheckServiceProvider: Provider<AppCheckInternalComponentName>, config: ConfigInternal);
_initializeWithPersistence(persistenceHierarchy: PersistenceInternal[], popupRedirectResolver?: PopupRedirectResolver): Promise<void>;
/**
* If the persistence is changed in another window, the user manager will let us know
*/
_onStorageEvent(): Promise<void>;
private initializeCurrentUserFromIdToken;
private initializeCurrentUser;
private tryRedirectSignIn;
private reloadAndSetCurrentUserOrClear;
useDeviceLanguage(): void;
_delete(): Promise<void>;
updateCurrentUser(userExtern: User | null): Promise<void>;
_updateCurrentUser(user: User | null, skipBeforeStateCallbacks?: boolean): Promise<void>;
signOut(): Promise<void>;
setPersistence(persistence: Persistence): Promise<void>;
_getRecaptchaConfig(): RecaptchaConfig | null;
validatePassword(password: string): Promise<PasswordValidationStatus>;
_getPasswordPolicyInternal(): PasswordPolicyInternal | null;
_updatePasswordPolicy(): Promise<void>;
_getPersistence(): string;
_updateErrorMap(errorMap: AuthErrorMap): void;
onAuthStateChanged(nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
onIdTokenChanged(nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
authStateReady(): Promise<void>;
/**
* Revokes the given access token. Currently only supports Apple OAuth access tokens.
*/
revokeAccessToken(token: string): Promise<void>;
toJSON(): object;
_setRedirectUser(user: UserInternal | null, popupRedirectResolver?: PopupRedirectResolver): Promise<void>;
private getOrInitRedirectPersistenceManager;
_redirectUserForId(id: string): Promise<UserInternal | null>;
_persistUserIfCurrent(user: UserInternal): Promise<void>;
/** Notifies listeners only if the user is current */
_notifyListenersIfCurrent(user: UserInternal): void;
_key(): string;
_startProactiveRefresh(): void;
_stopProactiveRefresh(): void;
/** Returns the current user cast as the internal type */
get _currentUser(): UserInternal;
private notifyAuthListeners;
private registerStateListener;
/**
* Unprotected (from race conditions) method to set the current user. This
* should only be called from within a queued callback. This is necessary
* because the queue shouldn't rely on another queued callback.
*/
private directlySetCurrentUser;
private queue;
private get assertedPersistence();
private frameworks;
private clientVersion;
_logFramework(framework: string): void;
_getFrameworks(): readonly string[];
_getAdditionalHeaders(): Promise<Record<string, string>>;
_getAppCheckToken(): Promise<string | undefined>;
}
/**
* Method to be used to cast down to our private implementation of Auth.
* It will also handle unwrapping from the compat type if necessary
*
* @param auth Auth object passed in from developer
*/
export declare function _castAuth(auth: Auth): AuthInternal;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,42 @@
/**
* @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 { Auth } from '../../model/public_types';
/**
* Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
* Firebase Auth services.
*
* @remarks
* This must be called synchronously immediately following the first call to
* {@link initializeAuth}. Do not use with production credentials as emulator
* traffic is not encrypted.
*
*
* @example
* ```javascript
* connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });
* ```
*
* @param auth - The {@link Auth} instance.
* @param url - The URL at which the emulator is running (eg, 'http://localhost:9099').
* @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to
* `true` to disable the warning banner attached to the DOM.
*
* @public
*/
export declare function connectAuthEmulator(auth: Auth, url: string, options?: {
disableWarnings: boolean;
}): void;

View file

@ -0,0 +1,17 @@
/**
* @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.
*/
export {};

View file

@ -0,0 +1,35 @@
/**
* @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 { FirebaseAuthInternal } from '@firebase/auth-interop-types';
import { AuthInternal } from '../../model/auth';
interface TokenListener {
(tok: string | null): unknown;
}
export declare class AuthInterop implements FirebaseAuthInternal {
private readonly auth;
private readonly internalListeners;
constructor(auth: AuthInternal);
getUid(): string | null;
getToken(forceRefresh?: boolean): Promise<{
accessToken: string;
} | null>;
addAuthTokenListener(listener: TokenListener): void;
removeAuthTokenListener(listener: TokenListener): void;
private assertAuthConfigured;
private updateProactiveRefresh;
}
export {};

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,46 @@
/**
* @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 { Auth, Dependencies } from '../../model/public_types';
import { AuthImpl } from './auth_impl';
/**
* Initializes an {@link Auth} instance with fine-grained control over
* {@link Dependencies}.
*
* @remarks
*
* This function allows more control over the {@link Auth} instance than
* {@link getAuth}. `getAuth` uses platform-specific defaults to supply
* the {@link Dependencies}. In general, `getAuth` is the easiest way to
* initialize Auth and works for most use cases. Use `initializeAuth` if you
* need control over which persistence layer is used, or to minimize bundle
* size if you're not using either `signInWithPopup` or `signInWithRedirect`.
*
* For example, if your app only uses anonymous accounts and you only want
* accounts saved for the current session, initialize `Auth` with:
*
* ```js
* const auth = initializeAuth(app, {
* persistence: browserSessionPersistence,
* popupRedirectResolver: undefined,
* });
* ```
*
* @public
*/
export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth;
export declare function _initializeAuthInstance(auth: AuthImpl, deps?: Dependencies): void;

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,25 @@
/**
* @license
* Copyright 2022 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 { AuthInternal } from '../../model/auth';
import { Unsubscribe, User } from '../../model/public_types';
export declare class AuthMiddlewareQueue {
private readonly auth;
private readonly queue;
constructor(auth: AuthInternal);
pushCallback(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
runMiddleware(nextUser: User | null): Promise<void>;
}

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2022 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 {};

View file

@ -0,0 +1,59 @@
/**
* @license
* Copyright 2023 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 { GetPasswordPolicyResponse } from '../../api/password_policy/get_password_policy';
import { PasswordPolicyCustomStrengthOptions, PasswordPolicyInternal } from '../../model/password_policy';
import { PasswordValidationStatus } from '../../model/public_types';
/**
* Stores password policy requirements and provides password validation against the policy.
*
* @internal
*/
export declare class PasswordPolicyImpl implements PasswordPolicyInternal {
readonly customStrengthOptions: PasswordPolicyCustomStrengthOptions;
readonly allowedNonAlphanumericCharacters: string;
readonly enforcementState: string;
readonly forceUpgradeOnSignin: boolean;
readonly schemaVersion: number;
constructor(response: GetPasswordPolicyResponse);
validatePassword(password: string): PasswordValidationStatus;
/**
* Validates that the password meets the length options for the policy.
*
* @param password Password to validate.
* @param status Validation status.
*/
private validatePasswordLengthOptions;
/**
* Validates that the password meets the character options for the policy.
*
* @param password Password to validate.
* @param status Validation status.
*/
private validatePasswordCharacterOptions;
/**
* Updates the running validation status with the statuses for the character options.
* Expected to be called each time a character is processed to update each option status
* based on the current character.
*
* @param status Validation status.
* @param containsLowercaseCharacter Whether the character is a lowercase letter.
* @param containsUppercaseCharacter Whether the character is an uppercase letter.
* @param containsNumericCharacter Whether the character is a numeric character.
* @param containsNonAlphanumericCharacter Whether the character is a non-alphanumeric character.
*/
private updatePasswordCharacterOptionsStatuses;
}

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2023 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 {};

View file

@ -0,0 +1,23 @@
/**
* @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 { ClientPlatform } from '../util/version';
export declare const enum _ComponentName {
AUTH = "auth",
AUTH_INTERNAL = "auth-internal"
}
/** @internal */
export declare function registerAuth(clientPlatform: ClientPlatform): void;

View file

@ -0,0 +1,75 @@
/**
* @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 { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa';
import { AuthInternal } from '../../model/auth';
import { IdTokenResponse } from '../../model/id_token';
/**
* Interface that represents the credentials returned by an {@link AuthProvider}.
*
* @remarks
* Implementations specify the details about each auth provider's credential requirements.
*
* @public
*/
export declare class AuthCredential {
/**
* The authentication provider ID for the credential.
*
* @remarks
* For example, 'facebook.com', or 'google.com'.
*/
readonly providerId: string;
/**
* The authentication sign in method for the credential.
*
* @remarks
* For example, {@link SignInMethod}.EMAIL_PASSWORD, or
* {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method
* identifier as returned in {@link fetchSignInMethodsForEmail}.
*/
readonly signInMethod: string;
/** @internal */
protected constructor(
/**
* The authentication provider ID for the credential.
*
* @remarks
* For example, 'facebook.com', or 'google.com'.
*/
providerId: string,
/**
* The authentication sign in method for the credential.
*
* @remarks
* For example, {@link SignInMethod}.EMAIL_PASSWORD, or
* {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method
* identifier as returned in {@link fetchSignInMethodsForEmail}.
*/
signInMethod: string);
/**
* Returns a JSON-serializable representation of this object.
*
* @returns a JSON-serializable representation of this object.
*/
toJSON(): object;
/** @internal */
_getIdTokenResponse(_auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>;
/** @internal */
_linkToIdToken(_auth: AuthInternal, _idToken: string): Promise<IdTokenResponse>;
/** @internal */
_getReauthenticationResolver(_auth: AuthInternal): Promise<IdTokenResponse>;
}

View file

@ -0,0 +1,60 @@
/**
* @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 { AuthInternal } from '../../model/auth';
import { IdTokenResponse } from '../../model/id_token';
import { AuthCredential } from './auth_credential';
/**
* Interface that represents the credentials returned by {@link EmailAuthProvider} for
* {@link ProviderId}.PASSWORD
*
* @remarks
* Covers both {@link SignInMethod}.EMAIL_PASSWORD and
* {@link SignInMethod}.EMAIL_LINK.
*
* @public
*/
export declare class EmailAuthCredential extends AuthCredential {
/** @internal */
readonly _email: string;
/** @internal */
readonly _password: string;
/** @internal */
readonly _tenantId: string | null;
/** @internal */
private constructor();
/** @internal */
static _fromEmailAndPassword(email: string, password: string): EmailAuthCredential;
/** @internal */
static _fromEmailAndCode(email: string, oobCode: string, tenantId?: string | null): EmailAuthCredential;
/** {@inheritdoc AuthCredential.toJSON} */
toJSON(): object;
/**
* Static method to deserialize a JSON representation of an object into an {@link AuthCredential}.
*
* @param json - Either `object` or the stringified representation of the object. When string is
* provided, `JSON.parse` would be called first.
*
* @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.
*/
static fromJSON(json: object | string): EmailAuthCredential | null;
/** @internal */
_getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse>;
/** @internal */
_linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>;
/** @internal */
_getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,23 @@
/**
* @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.
*/
/**
* This file is required due to the circular dependency from the parent class to its children
*/
export { AuthCredential } from './auth_credential';
export { EmailAuthCredential } from './email';
export { OAuthCredential } from './oauth';
export { PhoneAuthCredential as PhoneAuthCredential } from './phone';

View file

@ -0,0 +1,81 @@
/**
* @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 { AuthInternal } from '../../model/auth';
import { IdTokenResponse } from '../../model/id_token';
import { AuthCredential } from './auth_credential';
export interface OAuthCredentialParams {
idToken?: string | null;
accessToken?: string | null;
oauthToken?: string;
secret?: string;
oauthTokenSecret?: string;
nonce?: string;
pendingToken?: string;
providerId: string;
signInMethod: string;
}
/**
* Represents the OAuth credentials returned by an {@link OAuthProvider}.
*
* @remarks
* Implementations specify the details about each auth provider's credential requirements.
*
* @public
*/
export declare class OAuthCredential extends AuthCredential {
/**
* The OAuth ID token associated with the credential if it belongs to an OIDC provider,
* such as `google.com`.
* @readonly
*/
idToken?: string;
/**
* The OAuth access token associated with the credential if it belongs to an
* {@link OAuthProvider}, such as `facebook.com`, `twitter.com`, etc.
* @readonly
*/
accessToken?: string;
/**
* The OAuth access token secret associated with the credential if it belongs to an OAuth 1.0
* provider, such as `twitter.com`.
* @readonly
*/
secret?: string;
private nonce?;
private pendingToken;
/** @internal */
static _fromParams(params: OAuthCredentialParams): OAuthCredential;
/** {@inheritdoc AuthCredential.toJSON} */
toJSON(): object;
/**
* Static method to deserialize a JSON representation of an object into an
* {@link AuthCredential}.
*
* @param json - Input can be either Object or the stringified representation of the object.
* When string is provided, JSON.parse would be called first.
*
* @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.
*/
static fromJSON(json: string | object): OAuthCredential | null;
/** @internal */
_getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse>;
/** @internal */
_linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>;
/** @internal */
_getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>;
private buildRequest;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,52 @@
/**
* @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 { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa';
import { SignInWithPhoneNumberRequest } from '../../api/authentication/sms';
import { AuthInternal } from '../../model/auth';
import { IdTokenResponse } from '../../model/id_token';
import { AuthCredential } from './auth_credential';
export interface PhoneAuthCredentialParameters {
verificationId?: string;
verificationCode?: string;
phoneNumber?: string;
temporaryProof?: string;
}
/**
* Represents the credentials returned by {@link PhoneAuthProvider}.
*
* @public
*/
export declare class PhoneAuthCredential extends AuthCredential {
private readonly params;
private constructor();
/** @internal */
static _fromVerification(verificationId: string, verificationCode: string): PhoneAuthCredential;
/** @internal */
static _fromTokenResponse(phoneNumber: string, temporaryProof: string): PhoneAuthCredential;
/** @internal */
_getIdTokenResponse(auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>;
/** @internal */
_linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>;
/** @internal */
_getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>;
/** @internal */
_makeVerificationRequest(): SignInWithPhoneNumberRequest;
/** {@inheritdoc AuthCredential.toJSON} */
toJSON(): object;
/** Generates a phone credential based on a plain object or a JSON string. */
static fromJSON(json: object | string): PhoneAuthCredential | null;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,52 @@
/**
* @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 { AuthInternal } from '../../model/auth';
import { IdTokenResponse } from '../../model/id_token';
import { AuthCredential } from './auth_credential';
/**
* @public
*/
export declare class SAMLAuthCredential extends AuthCredential {
private readonly pendingToken;
/** @internal */
private constructor();
/** @internal */
_getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse>;
/** @internal */
_linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>;
/** @internal */
_getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>;
/** {@inheritdoc AuthCredential.toJSON} */
toJSON(): object;
/**
* Static method to deserialize a JSON representation of an object into an
* {@link AuthCredential}.
*
* @param json - Input can be either Object or the stringified representation of the object.
* When string is provided, JSON.parse would be called first.
*
* @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.
*/
static fromJSON(json: string | object): SAMLAuthCredential | null;
/**
* Helper static method to avoid exposing the constructor to end users.
*
* @internal
*/
static _create(providerId: string, pendingToken: string): SAMLAuthCredential;
private buildRequest;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,325 @@
/**
* @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 { AuthErrorMap, User } from '../model/public_types';
import { ErrorFactory, ErrorMap } from '@firebase/util';
import { IdTokenMfaResponse } from '../api/authentication/mfa';
import { AppName } from '../model/auth';
import { AuthCredential } from './credentials';
/**
* Enumeration of Firebase Auth error codes.
*
* @internal
*/
export declare const enum AuthErrorCode {
ADMIN_ONLY_OPERATION = "admin-restricted-operation",
ARGUMENT_ERROR = "argument-error",
APP_NOT_AUTHORIZED = "app-not-authorized",
APP_NOT_INSTALLED = "app-not-installed",
CAPTCHA_CHECK_FAILED = "captcha-check-failed",
CODE_EXPIRED = "code-expired",
CORDOVA_NOT_READY = "cordova-not-ready",
CORS_UNSUPPORTED = "cors-unsupported",
CREDENTIAL_ALREADY_IN_USE = "credential-already-in-use",
CREDENTIAL_MISMATCH = "custom-token-mismatch",
CREDENTIAL_TOO_OLD_LOGIN_AGAIN = "requires-recent-login",
DEPENDENT_SDK_INIT_BEFORE_AUTH = "dependent-sdk-initialized-before-auth",
DYNAMIC_LINK_NOT_ACTIVATED = "dynamic-link-not-activated",
EMAIL_CHANGE_NEEDS_VERIFICATION = "email-change-needs-verification",
EMAIL_EXISTS = "email-already-in-use",
EMULATOR_CONFIG_FAILED = "emulator-config-failed",
EXPIRED_OOB_CODE = "expired-action-code",
EXPIRED_POPUP_REQUEST = "cancelled-popup-request",
INTERNAL_ERROR = "internal-error",
INVALID_API_KEY = "invalid-api-key",
INVALID_APP_CREDENTIAL = "invalid-app-credential",
INVALID_APP_ID = "invalid-app-id",
INVALID_AUTH = "invalid-user-token",
INVALID_AUTH_EVENT = "invalid-auth-event",
INVALID_CERT_HASH = "invalid-cert-hash",
INVALID_CODE = "invalid-verification-code",
INVALID_CONTINUE_URI = "invalid-continue-uri",
INVALID_CORDOVA_CONFIGURATION = "invalid-cordova-configuration",
INVALID_CUSTOM_TOKEN = "invalid-custom-token",
INVALID_DYNAMIC_LINK_DOMAIN = "invalid-dynamic-link-domain",
INVALID_EMAIL = "invalid-email",
INVALID_EMULATOR_SCHEME = "invalid-emulator-scheme",
INVALID_CREDENTIAL = "invalid-credential",
INVALID_MESSAGE_PAYLOAD = "invalid-message-payload",
INVALID_MFA_SESSION = "invalid-multi-factor-session",
INVALID_OAUTH_CLIENT_ID = "invalid-oauth-client-id",
INVALID_OAUTH_PROVIDER = "invalid-oauth-provider",
INVALID_OOB_CODE = "invalid-action-code",
INVALID_ORIGIN = "unauthorized-domain",
INVALID_PASSWORD = "wrong-password",
INVALID_PERSISTENCE = "invalid-persistence-type",
INVALID_PHONE_NUMBER = "invalid-phone-number",
INVALID_PROVIDER_ID = "invalid-provider-id",
INVALID_RECIPIENT_EMAIL = "invalid-recipient-email",
INVALID_SENDER = "invalid-sender",
INVALID_SESSION_INFO = "invalid-verification-id",
INVALID_TENANT_ID = "invalid-tenant-id",
LOGIN_BLOCKED = "login-blocked",
MFA_INFO_NOT_FOUND = "multi-factor-info-not-found",
MFA_REQUIRED = "multi-factor-auth-required",
MISSING_ANDROID_PACKAGE_NAME = "missing-android-pkg-name",
MISSING_APP_CREDENTIAL = "missing-app-credential",
MISSING_AUTH_DOMAIN = "auth-domain-config-required",
MISSING_CODE = "missing-verification-code",
MISSING_CONTINUE_URI = "missing-continue-uri",
MISSING_IFRAME_START = "missing-iframe-start",
MISSING_IOS_BUNDLE_ID = "missing-ios-bundle-id",
MISSING_OR_INVALID_NONCE = "missing-or-invalid-nonce",
MISSING_MFA_INFO = "missing-multi-factor-info",
MISSING_MFA_SESSION = "missing-multi-factor-session",
MISSING_PHONE_NUMBER = "missing-phone-number",
MISSING_PASSWORD = "missing-password",
MISSING_SESSION_INFO = "missing-verification-id",
MODULE_DESTROYED = "app-deleted",
NEED_CONFIRMATION = "account-exists-with-different-credential",
NETWORK_REQUEST_FAILED = "network-request-failed",
NULL_USER = "null-user",
NO_AUTH_EVENT = "no-auth-event",
NO_SUCH_PROVIDER = "no-such-provider",
OPERATION_NOT_ALLOWED = "operation-not-allowed",
OPERATION_NOT_SUPPORTED = "operation-not-supported-in-this-environment",
POPUP_BLOCKED = "popup-blocked",
POPUP_CLOSED_BY_USER = "popup-closed-by-user",
PROVIDER_ALREADY_LINKED = "provider-already-linked",
QUOTA_EXCEEDED = "quota-exceeded",
REDIRECT_CANCELLED_BY_USER = "redirect-cancelled-by-user",
REDIRECT_OPERATION_PENDING = "redirect-operation-pending",
REJECTED_CREDENTIAL = "rejected-credential",
SECOND_FACTOR_ALREADY_ENROLLED = "second-factor-already-in-use",
SECOND_FACTOR_LIMIT_EXCEEDED = "maximum-second-factor-count-exceeded",
TENANT_ID_MISMATCH = "tenant-id-mismatch",
TIMEOUT = "timeout",
TOKEN_EXPIRED = "user-token-expired",
TOO_MANY_ATTEMPTS_TRY_LATER = "too-many-requests",
UNAUTHORIZED_DOMAIN = "unauthorized-continue-uri",
UNSUPPORTED_FIRST_FACTOR = "unsupported-first-factor",
UNSUPPORTED_PERSISTENCE = "unsupported-persistence-type",
UNSUPPORTED_TENANT_OPERATION = "unsupported-tenant-operation",
UNVERIFIED_EMAIL = "unverified-email",
USER_CANCELLED = "user-cancelled",
USER_DELETED = "user-not-found",
USER_DISABLED = "user-disabled",
USER_MISMATCH = "user-mismatch",
USER_SIGNED_OUT = "user-signed-out",
WEAK_PASSWORD = "weak-password",
WEB_STORAGE_UNSUPPORTED = "web-storage-unsupported",
ALREADY_INITIALIZED = "already-initialized",
RECAPTCHA_NOT_ENABLED = "recaptcha-not-enabled",
MISSING_RECAPTCHA_TOKEN = "missing-recaptcha-token",
INVALID_RECAPTCHA_TOKEN = "invalid-recaptcha-token",
INVALID_RECAPTCHA_ACTION = "invalid-recaptcha-action",
MISSING_CLIENT_TYPE = "missing-client-type",
MISSING_RECAPTCHA_VERSION = "missing-recaptcha-version",
INVALID_RECAPTCHA_VERSION = "invalid-recaptcha-version",
INVALID_REQ_TYPE = "invalid-req-type",
UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION = "unsupported-password-policy-schema-version",
PASSWORD_DOES_NOT_MEET_REQUIREMENTS = "password-does-not-meet-requirements"
}
export interface ErrorMapRetriever extends AuthErrorMap {
(): ErrorMap<AuthErrorCode>;
}
/**
* A verbose error map with detailed descriptions for most error codes.
*
* See discussion at {@link AuthErrorMap}
*
* @public
*/
export declare const debugErrorMap: AuthErrorMap;
/**
* A minimal error map with all verbose error messages stripped.
*
* See discussion at {@link AuthErrorMap}
*
* @public
*/
export declare const prodErrorMap: AuthErrorMap;
export interface NamedErrorParams {
appName: AppName;
credential?: AuthCredential;
email?: string;
phoneNumber?: string;
tenantId?: string;
user?: User;
_serverResponse?: object;
}
/**
* @internal
*/
declare type GenericAuthErrorParams = {
[key in Exclude<AuthErrorCode, AuthErrorCode.ARGUMENT_ERROR | AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH | AuthErrorCode.INTERNAL_ERROR | AuthErrorCode.MFA_REQUIRED | AuthErrorCode.NO_AUTH_EVENT | AuthErrorCode.OPERATION_NOT_SUPPORTED>]: {
appName?: AppName;
email?: string;
phoneNumber?: string;
message?: string;
};
};
/**
* @internal
*/
export interface AuthErrorParams extends GenericAuthErrorParams {
[AuthErrorCode.ARGUMENT_ERROR]: {
appName?: AppName;
};
[AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]: {
appName?: AppName;
};
[AuthErrorCode.INTERNAL_ERROR]: {
appName?: AppName;
};
[AuthErrorCode.LOGIN_BLOCKED]: {
appName?: AppName;
originalMessage?: string;
};
[AuthErrorCode.OPERATION_NOT_SUPPORTED]: {
appName?: AppName;
};
[AuthErrorCode.NO_AUTH_EVENT]: {
appName?: AppName;
};
[AuthErrorCode.MFA_REQUIRED]: {
appName: AppName;
_serverResponse: IdTokenMfaResponse;
};
[AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]: {
appName: AppName;
missingPlugin?: string;
};
}
export declare const _DEFAULT_AUTH_ERROR_FACTORY: ErrorFactory<AuthErrorCode, AuthErrorParams>;
/**
* A map of potential `Auth` error codes, for easier comparison with errors
* thrown by the SDK.
*
* @remarks
* Note that you can't tree-shake individual keys
* in the map, so by using the map you might substantially increase your
* bundle size.
*
* @public
*/
export declare const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY: {
readonly ADMIN_ONLY_OPERATION: "auth/admin-restricted-operation";
readonly ARGUMENT_ERROR: "auth/argument-error";
readonly APP_NOT_AUTHORIZED: "auth/app-not-authorized";
readonly APP_NOT_INSTALLED: "auth/app-not-installed";
readonly CAPTCHA_CHECK_FAILED: "auth/captcha-check-failed";
readonly CODE_EXPIRED: "auth/code-expired";
readonly CORDOVA_NOT_READY: "auth/cordova-not-ready";
readonly CORS_UNSUPPORTED: "auth/cors-unsupported";
readonly CREDENTIAL_ALREADY_IN_USE: "auth/credential-already-in-use";
readonly CREDENTIAL_MISMATCH: "auth/custom-token-mismatch";
readonly CREDENTIAL_TOO_OLD_LOGIN_AGAIN: "auth/requires-recent-login";
readonly DEPENDENT_SDK_INIT_BEFORE_AUTH: "auth/dependent-sdk-initialized-before-auth";
readonly DYNAMIC_LINK_NOT_ACTIVATED: "auth/dynamic-link-not-activated";
readonly EMAIL_CHANGE_NEEDS_VERIFICATION: "auth/email-change-needs-verification";
readonly EMAIL_EXISTS: "auth/email-already-in-use";
readonly EMULATOR_CONFIG_FAILED: "auth/emulator-config-failed";
readonly EXPIRED_OOB_CODE: "auth/expired-action-code";
readonly EXPIRED_POPUP_REQUEST: "auth/cancelled-popup-request";
readonly INTERNAL_ERROR: "auth/internal-error";
readonly INVALID_API_KEY: "auth/invalid-api-key";
readonly INVALID_APP_CREDENTIAL: "auth/invalid-app-credential";
readonly INVALID_APP_ID: "auth/invalid-app-id";
readonly INVALID_AUTH: "auth/invalid-user-token";
readonly INVALID_AUTH_EVENT: "auth/invalid-auth-event";
readonly INVALID_CERT_HASH: "auth/invalid-cert-hash";
readonly INVALID_CODE: "auth/invalid-verification-code";
readonly INVALID_CONTINUE_URI: "auth/invalid-continue-uri";
readonly INVALID_CORDOVA_CONFIGURATION: "auth/invalid-cordova-configuration";
readonly INVALID_CUSTOM_TOKEN: "auth/invalid-custom-token";
readonly INVALID_DYNAMIC_LINK_DOMAIN: "auth/invalid-dynamic-link-domain";
readonly INVALID_EMAIL: "auth/invalid-email";
readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme";
readonly INVALID_IDP_RESPONSE: "auth/invalid-credential";
readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-credential";
readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload";
readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session";
readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id";
readonly INVALID_OAUTH_PROVIDER: "auth/invalid-oauth-provider";
readonly INVALID_OOB_CODE: "auth/invalid-action-code";
readonly INVALID_ORIGIN: "auth/unauthorized-domain";
readonly INVALID_PASSWORD: "auth/wrong-password";
readonly INVALID_PERSISTENCE: "auth/invalid-persistence-type";
readonly INVALID_PHONE_NUMBER: "auth/invalid-phone-number";
readonly INVALID_PROVIDER_ID: "auth/invalid-provider-id";
readonly INVALID_RECIPIENT_EMAIL: "auth/invalid-recipient-email";
readonly INVALID_SENDER: "auth/invalid-sender";
readonly INVALID_SESSION_INFO: "auth/invalid-verification-id";
readonly INVALID_TENANT_ID: "auth/invalid-tenant-id";
readonly MFA_INFO_NOT_FOUND: "auth/multi-factor-info-not-found";
readonly MFA_REQUIRED: "auth/multi-factor-auth-required";
readonly MISSING_ANDROID_PACKAGE_NAME: "auth/missing-android-pkg-name";
readonly MISSING_APP_CREDENTIAL: "auth/missing-app-credential";
readonly MISSING_AUTH_DOMAIN: "auth/auth-domain-config-required";
readonly MISSING_CODE: "auth/missing-verification-code";
readonly MISSING_CONTINUE_URI: "auth/missing-continue-uri";
readonly MISSING_IFRAME_START: "auth/missing-iframe-start";
readonly MISSING_IOS_BUNDLE_ID: "auth/missing-ios-bundle-id";
readonly MISSING_OR_INVALID_NONCE: "auth/missing-or-invalid-nonce";
readonly MISSING_MFA_INFO: "auth/missing-multi-factor-info";
readonly MISSING_MFA_SESSION: "auth/missing-multi-factor-session";
readonly MISSING_PHONE_NUMBER: "auth/missing-phone-number";
readonly MISSING_SESSION_INFO: "auth/missing-verification-id";
readonly MODULE_DESTROYED: "auth/app-deleted";
readonly NEED_CONFIRMATION: "auth/account-exists-with-different-credential";
readonly NETWORK_REQUEST_FAILED: "auth/network-request-failed";
readonly NULL_USER: "auth/null-user";
readonly NO_AUTH_EVENT: "auth/no-auth-event";
readonly NO_SUCH_PROVIDER: "auth/no-such-provider";
readonly OPERATION_NOT_ALLOWED: "auth/operation-not-allowed";
readonly OPERATION_NOT_SUPPORTED: "auth/operation-not-supported-in-this-environment";
readonly POPUP_BLOCKED: "auth/popup-blocked";
readonly POPUP_CLOSED_BY_USER: "auth/popup-closed-by-user";
readonly PROVIDER_ALREADY_LINKED: "auth/provider-already-linked";
readonly QUOTA_EXCEEDED: "auth/quota-exceeded";
readonly REDIRECT_CANCELLED_BY_USER: "auth/redirect-cancelled-by-user";
readonly REDIRECT_OPERATION_PENDING: "auth/redirect-operation-pending";
readonly REJECTED_CREDENTIAL: "auth/rejected-credential";
readonly SECOND_FACTOR_ALREADY_ENROLLED: "auth/second-factor-already-in-use";
readonly SECOND_FACTOR_LIMIT_EXCEEDED: "auth/maximum-second-factor-count-exceeded";
readonly TENANT_ID_MISMATCH: "auth/tenant-id-mismatch";
readonly TIMEOUT: "auth/timeout";
readonly TOKEN_EXPIRED: "auth/user-token-expired";
readonly TOO_MANY_ATTEMPTS_TRY_LATER: "auth/too-many-requests";
readonly UNAUTHORIZED_DOMAIN: "auth/unauthorized-continue-uri";
readonly UNSUPPORTED_FIRST_FACTOR: "auth/unsupported-first-factor";
readonly UNSUPPORTED_PERSISTENCE: "auth/unsupported-persistence-type";
readonly UNSUPPORTED_TENANT_OPERATION: "auth/unsupported-tenant-operation";
readonly UNVERIFIED_EMAIL: "auth/unverified-email";
readonly USER_CANCELLED: "auth/user-cancelled";
readonly USER_DELETED: "auth/user-not-found";
readonly USER_DISABLED: "auth/user-disabled";
readonly USER_MISMATCH: "auth/user-mismatch";
readonly USER_SIGNED_OUT: "auth/user-signed-out";
readonly WEAK_PASSWORD: "auth/weak-password";
readonly WEB_STORAGE_UNSUPPORTED: "auth/web-storage-unsupported";
readonly ALREADY_INITIALIZED: "auth/already-initialized";
readonly RECAPTCHA_NOT_ENABLED: "auth/recaptcha-not-enabled";
readonly MISSING_RECAPTCHA_TOKEN: "auth/missing-recaptcha-token";
readonly INVALID_RECAPTCHA_TOKEN: "auth/invalid-recaptcha-token";
readonly INVALID_RECAPTCHA_ACTION: "auth/invalid-recaptcha-action";
readonly MISSING_CLIENT_TYPE: "auth/missing-client-type";
readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version";
readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version";
readonly INVALID_REQ_TYPE: "auth/invalid-req-type";
};
export {};

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,230 @@
/**
* @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 { Auth, NextOrObserver, Persistence, User, CompleteFn, ErrorFn, Unsubscribe, PasswordValidationStatus } from '../model/public_types';
export { debugErrorMap, prodErrorMap, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as AuthErrorCodes } from './errors';
/**
* Changes the type of persistence on the {@link Auth} instance for the currently saved
* `Auth` session and applies this type of persistence for future sign-in requests, including
* sign-in with redirect requests.
*
* @remarks
* This makes it easy for a user signing in to specify whether their session should be
* remembered or not. It also makes it easier to never persist the `Auth` state for applications
* that are shared by other users or have sensitive data.
*
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
* {@link @firebase/app#FirebaseServerApp}.
*
* @example
* ```javascript
* setPersistence(auth, browserSessionPersistence);
* ```
*
* @param auth - The {@link Auth} instance.
* @param persistence - The {@link Persistence} to use.
* @returns A `Promise` that resolves once the persistence change has completed
*
* @public
*/
export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>;
/**
* Loads the reCAPTCHA configuration into the `Auth` instance.
*
* @remarks
* This will load the reCAPTCHA config, which indicates whether the reCAPTCHA
* verification flow should be triggered for each auth provider, into the
* current Auth session.
*
* If initializeRecaptchaConfig() is not invoked, the auth flow will always start
* without reCAPTCHA verification. If the provider is configured to require reCAPTCHA
* verification, the SDK will transparently load the reCAPTCHA config and restart the
* auth flows.
*
* Thus, by calling this optional method, you will reduce the latency of future auth flows.
* Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.
*
* This method does not work in a Node.js environment.
*
* @example
* ```javascript
* initializeRecaptchaConfig(auth);
* ```
*
* @param auth - The {@link Auth} instance.
*
* @public
*/
export declare function initializeRecaptchaConfig(auth: Auth): Promise<void>;
/**
* Validates the password against the password policy configured for the project or tenant.
*
* @remarks
* If no tenant ID is set on the `Auth` instance, then this method will use the password
* policy configured for the project. Otherwise, this method will use the policy configured
* for the tenant. If a password policy has not been configured, then the default policy
* configured for all projects will be used.
*
* If an auth flow fails because a submitted password does not meet the password policy
* requirements and this method has previously been called, then this method will use the
* most recent policy available when called again.
*
* @example
* ```javascript
* validatePassword(auth, 'some-password');
* ```
*
* @param auth The {@link Auth} instance.
* @param password The password to validate.
*
* @public
*/
export declare function validatePassword(auth: Auth, password: string): Promise<PasswordValidationStatus>;
/**
* Adds an observer for changes to the signed-in user's ID token.
*
* @remarks
* This includes sign-in, sign-out, and token refresh events.
* This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.
*
* @param auth - The {@link Auth} instance.
* @param nextOrObserver - callback triggered on change.
* @param error - Deprecated. This callback is never triggered. Errors
* on signing in/out can be caught in promises returned from
* sign-in/sign-out functions.
* @param completed - Deprecated. This callback is never triggered.
*
* @public
*/
export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
/**
* Adds a blocking callback that runs before an auth state change
* sets a new user.
*
* @param auth - The {@link Auth} instance.
* @param callback - callback triggered before new user value is set.
* If this throws, it blocks the user from being set.
* @param onAbort - callback triggered if a later `beforeAuthStateChanged()`
* callback throws, allowing you to undo any side effects.
*/
export declare function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
/**
* Adds an observer for changes to the user's sign-in state.
*
* @remarks
* To keep the old behavior, see {@link onIdTokenChanged}.
*
* @param auth - The {@link Auth} instance.
* @param nextOrObserver - callback triggered on change.
* @param error - Deprecated. This callback is never triggered. Errors
* on signing in/out can be caught in promises returned from
* sign-in/sign-out functions.
* @param completed - Deprecated. This callback is never triggered.
*
* @public
*/
export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
/**
* Sets the current language to the default device/browser preference.
*
* @param auth - The {@link Auth} instance.
*
* @public
*/
export declare function useDeviceLanguage(auth: Auth): void;
/**
* Asynchronously sets the provided user as {@link Auth.currentUser} on the
* {@link Auth} instance.
*
* @remarks
* A new instance copy of the user provided will be made and set as currentUser.
*
* This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners
* like other sign in methods.
*
* The operation fails with an error if the user to be updated belongs to a different Firebase
* project.
*
* This method is not supported by {@link Auth} instances created with a
* {@link @firebase/app#FirebaseServerApp}.
*
* @param auth - The {@link Auth} instance.
* @param user - The new {@link User}.
*
* @public
*/
export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>;
/**
* Signs out the current user.
*
* @remarks
* This method is not supported by {@link Auth} instances created with a
* {@link @firebase/app#FirebaseServerApp}.
*
* @param auth - The {@link Auth} instance.
*
* @public
*/
export declare function signOut(auth: Auth): Promise<void>;
/**
* Revokes the given access token. Currently only supports Apple OAuth access tokens.
*
* @param auth - The {@link Auth} instance.
* @param token - The Apple OAuth access token.
*
* @public
*/
export declare function revokeAccessToken(auth: Auth, token: string): Promise<void>;
export { initializeAuth } from './auth/initialize';
export { connectAuthEmulator } from './auth/emulator';
export { AuthCredential } from './credentials';
export { EmailAuthCredential } from './credentials/email';
export { OAuthCredential } from './credentials/oauth';
export { PhoneAuthCredential } from './credentials/phone';
export { inMemoryPersistence } from './persistence/in_memory';
export { EmailAuthProvider } from './providers/email';
export { FacebookAuthProvider } from './providers/facebook';
export { CustomParameters } from './providers/federated';
export { GoogleAuthProvider } from './providers/google';
export { GithubAuthProvider } from './providers/github';
export { OAuthProvider, OAuthCredentialOptions } from './providers/oauth';
export { SAMLAuthProvider } from './providers/saml';
export { TwitterAuthProvider } from './providers/twitter';
export { signInAnonymously } from './strategies/anonymous';
export { signInWithCredential, linkWithCredential, reauthenticateWithCredential } from './strategies/credential';
export { signInWithCustomToken } from './strategies/custom_token';
export { sendPasswordResetEmail, confirmPasswordReset, applyActionCode, checkActionCode, verifyPasswordResetCode, createUserWithEmailAndPassword, signInWithEmailAndPassword } from './strategies/email_and_password';
export { sendSignInLinkToEmail, isSignInWithEmailLink, signInWithEmailLink } from './strategies/email_link';
export { fetchSignInMethodsForEmail, sendEmailVerification, verifyBeforeUpdateEmail } from './strategies/email';
export { ActionCodeURL, parseActionCodeURL } from './action_code_url';
export { updateProfile, updateEmail, updatePassword } from './user/account_info';
export { getIdToken, getIdTokenResult } from './user/id_token_result';
export { unlink } from './user/link_unlink';
export { getAdditionalUserInfo } from './user/additional_user_info';
export { reload } from './user/reload';
/**
* Deletes and signs out the user.
*
* @remarks
* Important: this is a security-sensitive operation that requires the user to have recently
* signed in. If this requirement isn't met, ask the user to authenticate again and then call
* {@link reauthenticateWithCredential}.
*
* @param user - The user.
*
* @public
*/
export declare function deleteUser(user: User): Promise<void>;

View file

@ -0,0 +1,35 @@
/**
* @license
* Copyright 2019 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 { Persistence } from '../../model/public_types';
import { PersistenceInternal, PersistenceType, PersistenceValue, StorageEventListener } from '../persistence';
export declare class InMemoryPersistence implements PersistenceInternal {
static type: 'NONE';
readonly type = PersistenceType.NONE;
storage: Record<string, PersistenceValue>;
_isAvailable(): Promise<boolean>;
_set(key: string, value: PersistenceValue): Promise<void>;
_get<T extends PersistenceValue>(key: string): Promise<T | null>;
_remove(key: string): Promise<void>;
_addListener(_key: string, _listener: StorageEventListener): void;
_removeListener(_key: string, _listener: StorageEventListener): void;
}
/**
* An implementation of {@link Persistence} of type 'NONE'.
*
* @public
*/
export declare const inMemoryPersistence: Persistence;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 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 {};

View file

@ -0,0 +1,41 @@
/**
* @license
* Copyright 2019 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 { Persistence } from '../../model/public_types';
export declare const enum PersistenceType {
SESSION = "SESSION",
LOCAL = "LOCAL",
NONE = "NONE"
}
export declare type PersistedBlob = Record<string, unknown>;
export interface Instantiator<T> {
(blob: PersistedBlob): T;
}
export declare type PersistenceValue = PersistedBlob | string;
export declare const STORAGE_AVAILABLE_KEY = "__sak";
export interface StorageEventListener {
(value: PersistenceValue | null): void;
}
export interface PersistenceInternal extends Persistence {
type: PersistenceType;
_isAvailable(): Promise<boolean>;
_set(key: string, value: PersistenceValue): Promise<void>;
_get<T extends PersistenceValue>(key: string): Promise<T | null>;
_remove(key: string): Promise<void>;
_addListener(key: string, listener: StorageEventListener): void;
_removeListener(key: string, listener: StorageEventListener): void;
_shouldAllowMigration?: boolean;
}

View file

@ -0,0 +1,45 @@
/**
* @license
* Copyright 2019 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 { ApiKey, AppName, AuthInternal } from '../../model/auth';
import { UserInternal } from '../../model/user';
import { PersistenceInternal } from '../persistence';
export declare const enum KeyName {
AUTH_USER = "authUser",
AUTH_EVENT = "authEvent",
REDIRECT_USER = "redirectUser",
PERSISTENCE_USER = "persistence"
}
export declare const enum Namespace {
PERSISTENCE = "firebase"
}
export declare function _persistenceKeyName(key: string, apiKey: ApiKey, appName: AppName): string;
export declare class PersistenceUserManager {
persistence: PersistenceInternal;
private readonly auth;
private readonly userKey;
private readonly fullUserKey;
private readonly fullPersistenceKey;
private readonly boundEventHandler;
private constructor();
setCurrentUser(user: UserInternal): Promise<void>;
getCurrentUser(): Promise<UserInternal | null>;
removeCurrentUser(): Promise<void>;
savePersistenceForRedirect(): Promise<void>;
setPersistence(newPersistence: PersistenceInternal): Promise<void>;
delete(): void;
static create(auth: AuthInternal, persistenceHierarchy: PersistenceInternal[], userKey?: KeyName): Promise<PersistenceUserManager>;
}

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 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 {};

View file

@ -0,0 +1,83 @@
/**
* @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 { AuthProvider } from '../../model/public_types';
import { EmailAuthCredential } from '../credentials/email';
/**
* Provider for generating {@link EmailAuthCredential}.
*
* @public
*/
export declare class EmailAuthProvider implements AuthProvider {
/**
* Always set to {@link ProviderId}.PASSWORD, even for email link.
*/
static readonly PROVIDER_ID: 'password';
/**
* Always set to {@link SignInMethod}.EMAIL_PASSWORD.
*/
static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password';
/**
* Always set to {@link SignInMethod}.EMAIL_LINK.
*/
static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink';
/**
* Always set to {@link ProviderId}.PASSWORD, even for email link.
*/
readonly providerId: "password";
/**
* Initialize an {@link AuthCredential} using an email and password.
*
* @example
* ```javascript
* const authCredential = EmailAuthProvider.credential(email, password);
* const userCredential = await signInWithCredential(auth, authCredential);
* ```
*
* @example
* ```javascript
* const userCredential = await signInWithEmailAndPassword(auth, email, password);
* ```
*
* @param email - Email address.
* @param password - User account password.
* @returns The auth provider credential.
*/
static credential(email: string, password: string): EmailAuthCredential;
/**
* Initialize an {@link AuthCredential} using an email and an email link after a sign in with
* email link operation.
*
* @example
* ```javascript
* const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);
* const userCredential = await signInWithCredential(auth, authCredential);
* ```
*
* @example
* ```javascript
* await sendSignInLinkToEmail(auth, email);
* // Obtain emailLink from user.
* const userCredential = await signInWithEmailLink(auth, email, emailLink);
* ```
*
* @param auth - The {@link Auth} instance used to verify the link.
* @param email - Email address.
* @param emailLink - Sign-in email link.
* @returns - The auth provider credential.
*/
static credentialWithLink(email: string, emailLink: string): EmailAuthCredential;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,93 @@
/**
* @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 { UserCredential } from '../../model/public_types';
import { FirebaseError } from '@firebase/util';
import { OAuthCredential } from '../credentials/oauth';
import { BaseOAuthProvider } from './oauth';
/**
* Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK.
*
* @example
* ```javascript
* // Sign in using a redirect.
* const provider = new FacebookAuthProvider();
* // Start a sign in process for an unauthenticated user.
* provider.addScope('user_birthday');
* await signInWithRedirect(auth, provider);
* // This will trigger a full page redirect away from your app
*
* // After returning from the redirect when your app initializes you can obtain the result
* const result = await getRedirectResult(auth);
* if (result) {
* // This is the signed-in user
* const user = result.user;
* // This gives you a Facebook Access Token.
* const credential = FacebookAuthProvider.credentialFromResult(result);
* const token = credential.accessToken;
* }
* ```
*
* @example
* ```javascript
* // Sign in using a popup.
* const provider = new FacebookAuthProvider();
* provider.addScope('user_birthday');
* const result = await signInWithPopup(auth, provider);
*
* // The signed-in user info.
* const user = result.user;
* // This gives you a Facebook Access Token.
* const credential = FacebookAuthProvider.credentialFromResult(result);
* const token = credential.accessToken;
* ```
*
* @public
*/
export declare class FacebookAuthProvider extends BaseOAuthProvider {
/** Always set to {@link SignInMethod}.FACEBOOK. */
static readonly FACEBOOK_SIGN_IN_METHOD: 'facebook.com';
/** Always set to {@link ProviderId}.FACEBOOK. */
static readonly PROVIDER_ID: 'facebook.com';
constructor();
/**
* Creates a credential for Facebook.
*
* @example
* ```javascript
* // `event` from the Facebook auth.authResponseChange callback.
* const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);
* const result = await signInWithCredential(credential);
* ```
*
* @param accessToken - Facebook access token.
*/
static credential(accessToken: string): OAuthCredential;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
*
* @param userCredential - The user credential.
*/
static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
* thrown during a sign-in, link, or reauthenticate operation.
*
* @param userCredential - The user credential.
*/
static credentialFromError(error: FirebaseError): OAuthCredential | null;
private static credentialFromTaggedObject;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,64 @@
/**
* @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 { AuthProvider } from '../../model/public_types';
/**
* Map of OAuth Custom Parameters.
*
* @public
*/
export declare type CustomParameters = Record<string, string>;
/**
* The base class for all Federated providers (OAuth (including OIDC), SAML).
*
* This class is not meant to be instantiated directly.
*
* @public
*/
export declare abstract class FederatedAuthProvider implements AuthProvider {
readonly providerId: string;
/** @internal */
defaultLanguageCode: string | null;
/** @internal */
private customParameters;
/**
* Constructor for generic OAuth providers.
*
* @param providerId - Provider for which credentials should be generated.
*/
constructor(providerId: string);
/**
* Set the language gode.
*
* @param languageCode - language code
*/
setDefaultLanguage(languageCode: string | null): void;
/**
* Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in
* operations.
*
* @remarks
* For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`,
* `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored.
*
* @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request.
*/
setCustomParameters(customOAuthParameters: CustomParameters): AuthProvider;
/**
* Retrieve the current list of {@link CustomParameters}.
*/
getCustomParameters(): CustomParameters;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,89 @@
/**
* @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 { UserCredential } from '../../model/public_types';
import { FirebaseError } from '@firebase/util';
import { OAuthCredential } from '../credentials/oauth';
import { BaseOAuthProvider } from './oauth';
/**
* Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB.
*
* @remarks
* GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use
* the {@link signInWithPopup} handler:
*
* @example
* ```javascript
* // Sign in using a redirect.
* const provider = new GithubAuthProvider();
* // Start a sign in process for an unauthenticated user.
* provider.addScope('repo');
* await signInWithRedirect(auth, provider);
* // This will trigger a full page redirect away from your app
*
* // After returning from the redirect when your app initializes you can obtain the result
* const result = await getRedirectResult(auth);
* if (result) {
* // This is the signed-in user
* const user = result.user;
* // This gives you a GitHub Access Token.
* const credential = GithubAuthProvider.credentialFromResult(result);
* const token = credential.accessToken;
* }
* ```
*
* @example
* ```javascript
* // Sign in using a popup.
* const provider = new GithubAuthProvider();
* provider.addScope('repo');
* const result = await signInWithPopup(auth, provider);
*
* // The signed-in user info.
* const user = result.user;
* // This gives you a GitHub Access Token.
* const credential = GithubAuthProvider.credentialFromResult(result);
* const token = credential.accessToken;
* ```
* @public
*/
export declare class GithubAuthProvider extends BaseOAuthProvider {
/** Always set to {@link SignInMethod}.GITHUB. */
static readonly GITHUB_SIGN_IN_METHOD: 'github.com';
/** Always set to {@link ProviderId}.GITHUB. */
static readonly PROVIDER_ID: 'github.com';
constructor();
/**
* Creates a credential for GitHub.
*
* @param accessToken - GitHub access token.
*/
static credential(accessToken: string): OAuthCredential;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
*
* @param userCredential - The user credential.
*/
static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
* thrown during a sign-in, link, or reauthenticate operation.
*
* @param userCredential - The user credential.
*/
static credentialFromError(error: FirebaseError): OAuthCredential | null;
private static credentialFromTaggedObject;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,96 @@
/**
* @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 { UserCredential } from '../../model/public_types';
import { FirebaseError } from '@firebase/util';
import { OAuthCredential } from '../credentials/oauth';
import { BaseOAuthProvider } from './oauth';
/**
* Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE.
*
* @example
* ```javascript
* // Sign in using a redirect.
* const provider = new GoogleAuthProvider();
* // Start a sign in process for an unauthenticated user.
* provider.addScope('profile');
* provider.addScope('email');
* await signInWithRedirect(auth, provider);
* // This will trigger a full page redirect away from your app
*
* // After returning from the redirect when your app initializes you can obtain the result
* const result = await getRedirectResult(auth);
* if (result) {
* // This is the signed-in user
* const user = result.user;
* // This gives you a Google Access Token.
* const credential = GoogleAuthProvider.credentialFromResult(result);
* const token = credential.accessToken;
* }
* ```
*
* @example
* ```javascript
* // Sign in using a popup.
* const provider = new GoogleAuthProvider();
* provider.addScope('profile');
* provider.addScope('email');
* const result = await signInWithPopup(auth, provider);
*
* // The signed-in user info.
* const user = result.user;
* // This gives you a Google Access Token.
* const credential = GoogleAuthProvider.credentialFromResult(result);
* const token = credential.accessToken;
* ```
*
* @public
*/
export declare class GoogleAuthProvider extends BaseOAuthProvider {
/** Always set to {@link SignInMethod}.GOOGLE. */
static readonly GOOGLE_SIGN_IN_METHOD: 'google.com';
/** Always set to {@link ProviderId}.GOOGLE. */
static readonly PROVIDER_ID: 'google.com';
constructor();
/**
* Creates a credential for Google. At least one of ID token and access token is required.
*
* @example
* ```javascript
* // \`googleUser\` from the onsuccess Google Sign In callback.
* const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);
* const result = await signInWithCredential(credential);
* ```
*
* @param idToken - Google ID token.
* @param accessToken - Google access token.
*/
static credential(idToken?: string | null, accessToken?: string | null): OAuthCredential;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
*
* @param userCredential - The user credential.
*/
static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
* thrown during a sign-in, link, or reauthenticate operation.
*
* @param userCredential - The user credential.
*/
static credentialFromError(error: FirebaseError): OAuthCredential | null;
private static credentialFromTaggedObject;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,151 @@
/**
* @license
* Copyright 2019 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 { AuthProvider, UserCredential } from '../../model/public_types';
import { OAuthCredential } from '../credentials/oauth';
import { FirebaseError } from '@firebase/util';
import { FederatedAuthProvider } from './federated';
/**
* Defines the options for initializing an {@link OAuthCredential}.
*
* @remarks
* For ID tokens with nonce claim, the raw nonce has to also be provided.
*
* @public
*/
export interface OAuthCredentialOptions {
/**
* The OAuth ID token used to initialize the {@link OAuthCredential}.
*/
idToken?: string;
/**
* The OAuth access token used to initialize the {@link OAuthCredential}.
*/
accessToken?: string;
/**
* The raw nonce associated with the ID token.
*
* @remarks
* It is required when an ID token with a nonce field is provided. The SHA-256 hash of the
* raw nonce must match the nonce field in the ID token.
*/
rawNonce?: string;
}
/**
* Common code to all OAuth providers. This is separate from the
* {@link OAuthProvider} so that child providers (like
* {@link GoogleAuthProvider}) don't inherit the `credential` instance method.
* Instead, they rely on a static `credential` method.
*/
export declare abstract class BaseOAuthProvider extends FederatedAuthProvider implements AuthProvider {
/** @internal */
private scopes;
/**
* Add an OAuth scope to the credential.
*
* @param scope - Provider OAuth scope to add.
*/
addScope(scope: string): AuthProvider;
/**
* Retrieve the current list of OAuth scopes.
*/
getScopes(): string[];
}
/**
* Provider for generating generic {@link OAuthCredential}.
*
* @example
* ```javascript
* // Sign in using a redirect.
* const provider = new OAuthProvider('google.com');
* // Start a sign in process for an unauthenticated user.
* provider.addScope('profile');
* provider.addScope('email');
* await signInWithRedirect(auth, provider);
* // This will trigger a full page redirect away from your app
*
* // After returning from the redirect when your app initializes you can obtain the result
* const result = await getRedirectResult(auth);
* if (result) {
* // This is the signed-in user
* const user = result.user;
* // This gives you a OAuth Access Token for the provider.
* const credential = provider.credentialFromResult(auth, result);
* const token = credential.accessToken;
* }
* ```
*
* @example
* ```javascript
* // Sign in using a popup.
* const provider = new OAuthProvider('google.com');
* provider.addScope('profile');
* provider.addScope('email');
* const result = await signInWithPopup(auth, provider);
*
* // The signed-in user info.
* const user = result.user;
* // This gives you a OAuth Access Token for the provider.
* const credential = provider.credentialFromResult(auth, result);
* const token = credential.accessToken;
* ```
* @public
*/
export declare class OAuthProvider extends BaseOAuthProvider {
/**
* Creates an {@link OAuthCredential} from a JSON string or a plain object.
* @param json - A plain object or a JSON string
*/
static credentialFromJSON(json: object | string): OAuthCredential;
/**
* Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token.
*
* @remarks
* The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of
* the raw nonce must match the nonce field in the ID token.
*
* @example
* ```javascript
* // `googleUser` from the onsuccess Google Sign In callback.
* // Initialize a generate OAuth provider with a `google.com` providerId.
* const provider = new OAuthProvider('google.com');
* const credential = provider.credential({
* idToken: googleUser.getAuthResponse().id_token,
* });
* const result = await signInWithCredential(credential);
* ```
*
* @param params - Either the options object containing the ID token, access token and raw nonce
* or the ID token string.
*/
credential(params: OAuthCredentialOptions): OAuthCredential;
/** An internal credential method that accepts more permissive options */
private _credential;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
*
* @param userCredential - The user credential.
*/
static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
* thrown during a sign-in, link, or reauthenticate operation.
*
* @param userCredential - The user credential.
*/
static credentialFromError(error: FirebaseError): OAuthCredential | null;
private static oauthCredentialFromTaggedObject;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

View file

@ -0,0 +1,62 @@
/**
* @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 { FirebaseError } from '@firebase/util';
import { UserCredential } from '../../model/public_types';
import { AuthCredential } from '../credentials';
import { FederatedAuthProvider } from './federated';
/**
* An {@link AuthProvider} for SAML.
*
* @public
*/
export declare class SAMLAuthProvider extends FederatedAuthProvider {
/**
* Constructor. The providerId must start with "saml."
* @param providerId - SAML provider ID.
*/
constructor(providerId: string);
/**
* Generates an {@link AuthCredential} from a {@link UserCredential} after a
* successful SAML flow completes.
*
* @remarks
*
* For example, to get an {@link AuthCredential}, you could write the
* following code:
*
* ```js
* const userCredential = await signInWithPopup(auth, samlProvider);
* const credential = SAMLAuthProvider.credentialFromResult(userCredential);
* ```
*
* @param userCredential - The user credential.
*/
static credentialFromResult(userCredential: UserCredential): AuthCredential | null;
/**
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
* thrown during a sign-in, link, or reauthenticate operation.
*
* @param userCredential - The user credential.
*/
static credentialFromError(error: FirebaseError): AuthCredential | null;
/**
* Creates an {@link AuthCredential} from a JSON string or a plain object.
* @param json - A plain object or a JSON string
*/
static credentialFromJSON(json: string | object): AuthCredential;
private static samlCredentialFromTaggedObject;
}

View file

@ -0,0 +1,17 @@
/**
* @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 {};

Some files were not shown because too many files have changed in this diff Show more