/*! gcip-iap v2.0.1 */ /*! * Copyright 2019 Google Inc. * * 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 these from ciap/firebase-auth rather than @firebase/auth-types because * 1) @firebase/auth-types is not recommended for direct use - * https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth-types/README.md * * 2)The return values from methods implemented by AuthenticationHandler (like getAuth()) * are used by our SDK code and they use the ciap/firebase-auth types anyway - * https://team.git.corp.google.com/cicp-eng/cicp-iap-js/+/refs/heads/master/src/ciap/base-operation-handler.ts#254, * https://team.git.corp.google.com/cicp-eng/cicp-iap-js/+/refs/heads/master/src/ciap/base-operation-handler.ts#17 */ import { User, FirebaseAuth, UserCredential } from './ciap/firebase-auth'; // tslint:disable-next-line:no-namespace declare namespace ciap { interface CIAPError { httpErrorCode?: number; code: string; message: string; reason?: Error; retry?(): Promise; toJSON(): object; } interface ProjectConfig { projectId: string; apiKey: string; } interface SelectedTenantInfo { email?: string; tenantId: string | null; providerIds?: string[]; } interface AuthenticationHandler { // Language code. languageCode?: string | null; // Returns the Auth instance for the corresponding API key/tenant. getAuth(apiKey: string, tenantId: string | null): FirebaseAuth; // Starts sign in with the corresponding Auth instance. Developer is expected to show // the corresponding sign in options based on auth.tenantId. startSignIn(auth: FirebaseAuth, match?: SelectedTenantInfo): Promise; // Triggered after user is signed out from all tenants. // This is optional to provide the developer the ability to render their own // UI on signout. // This is not called on single tenant sign out. completeSignOut(): Promise; // Developer may want to make additional changes to the user before handing ID token to IAP. processUser?(user: User): Promise; showProgressBar?(): void; hideProgressBar?(): void; handleError?(error: Error | CIAPError): void; selectTenant?( projectConfig: ProjectConfig, tenantIds: string[], ): Promise; } class Authentication { constructor(handler: ciap.AuthenticationHandler); start(): void; getOriginalURL(): Promise; } } declare module 'gcip-iap' { } /* tslint:disable:export-just-namespace */ export = ciap;