MCPcopy Index your code
hub / github.com/NativeScript/firebase / AppCheck

Class AppCheck

packages/firebase-app-check/index.ios.ts:135–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133let provider;
134let customProvider: AppCheckProviderFactory;
135export class AppCheck implements IAppCheck {
136 _native: FIRAppCheck;
137 _nativeApp;
138 _app: FirebaseApp;
139 constructor(app?: FirebaseApp) {
140 if (app?.native) {
141 this._native = FIRAppCheck.appCheckWithApp(app.native);
142 this._nativeApp = app.native;
143 } else {
144 if (defaultAppCheck) {
145 return defaultAppCheck;
146 }
147 defaultAppCheck = this;
148 const app = FIRApp.defaultApp();
149 this._native = FIRAppCheck.appCheckWithApp(app);
150 this._nativeApp = app;
151 }
152 }
153
154 static setProviderFactory(custom?: AppCheckProviderFactory) {
155 if (custom && custom instanceof AppCheckProviderFactory) {
156 customProvider = custom;
157 FIRAppCheck.setAppCheckProviderFactory(custom.native);
158 } else {
159 if (!provider) {
160 provider = FIRAppCheckProviderFactoryImpl.alloc().init();
161 }
162 customProvider = undefined;
163 FIRAppCheck.setAppCheckProviderFactory(provider);
164 }
165 }
166
167 activate(isTokenAutoRefreshEnabled: boolean) {
168 this.native.isTokenAutoRefreshEnabled = isTokenAutoRefreshEnabled;
169 }
170
171 getToken(forceRefresh: boolean): Promise<AppCheckToken> {
172 return new Promise((resolve, reject) => {
173 this.native.tokenForcingRefreshCompletion(forceRefresh, (token, error) => {
174 if (error) {
175 const err = FirebaseError.fromNative(error);
176 reject(err);
177 } else {
178 resolve(AppCheckToken.fromNative(token));
179 }
180 });
181 });
182 }
183
184 setTokenAutoRefreshEnabled(enabled: boolean) {
185 this.native.isTokenAutoRefreshEnabled = enabled;
186 }
187
188 get native() {
189 return this._native;
190 }
191 get ios() {
192 return this.native;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…