@react-native-firebase/app-check 23.7.0 → 23.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/ReactNativeFirebaseAppCheckProvider.js +19 -0
- package/dist/commonjs/ReactNativeFirebaseAppCheckProvider.js.map +1 -0
- package/dist/commonjs/index.js +38 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/modular.js +124 -0
- package/dist/commonjs/modular.js.map +1 -0
- package/dist/commonjs/namespaced.js +212 -0
- package/dist/commonjs/namespaced.js.map +1 -0
- package/dist/commonjs/package.json +1 -0
- package/dist/commonjs/types/appcheck.js +93 -0
- package/dist/commonjs/types/appcheck.js.map +1 -0
- package/dist/commonjs/version.js +9 -0
- package/dist/commonjs/version.js.map +1 -0
- package/dist/commonjs/web/RNFBAppCheckModule.android.js +9 -0
- package/dist/commonjs/web/RNFBAppCheckModule.android.js.map +2 -0
- package/dist/commonjs/web/RNFBAppCheckModule.ios.js +9 -0
- package/dist/commonjs/web/RNFBAppCheckModule.ios.js.map +2 -0
- package/dist/commonjs/web/RNFBAppCheckModule.js +97 -0
- package/dist/commonjs/web/RNFBAppCheckModule.js.map +1 -0
- package/dist/module/ReactNativeFirebaseAppCheckProvider.js +14 -0
- package/dist/module/ReactNativeFirebaseAppCheckProvider.js.map +1 -0
- package/{ios/RNFBAppCheck/RNFBAppCheckModule.h → dist/module/index.js} +10 -12
- package/dist/module/index.js.map +1 -0
- package/dist/module/modular.js +110 -0
- package/dist/module/modular.js.map +1 -0
- package/{lib/index.js → dist/module/namespaced.js} +50 -80
- package/dist/module/namespaced.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/types/appcheck.js +89 -0
- package/dist/module/types/appcheck.js.map +1 -0
- package/dist/module/version.js +5 -0
- package/dist/module/version.js.map +1 -0
- package/dist/module/web/RNFBAppCheckModule.android.js +5 -0
- package/dist/module/web/RNFBAppCheckModule.android.js.map +2 -0
- package/dist/module/web/RNFBAppCheckModule.ios.js +5 -0
- package/dist/module/web/RNFBAppCheckModule.ios.js.map +2 -0
- package/dist/module/web/RNFBAppCheckModule.js +88 -0
- package/dist/module/web/RNFBAppCheckModule.js.map +1 -0
- package/dist/typescript/commonjs/lib/ReactNativeFirebaseAppCheckProvider.d.ts +8 -0
- package/dist/typescript/commonjs/lib/ReactNativeFirebaseAppCheckProvider.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/index.d.ts +5 -0
- package/dist/typescript/commonjs/lib/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/modular.d.ts +57 -0
- package/dist/typescript/commonjs/lib/modular.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/namespaced.d.ts +17 -0
- package/dist/typescript/commonjs/lib/namespaced.d.ts.map +1 -0
- package/{lib/index.d.ts → dist/typescript/commonjs/lib/types/appcheck.d.ts} +162 -221
- package/dist/typescript/commonjs/lib/types/appcheck.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/version.d.ts +2 -0
- package/dist/typescript/commonjs/lib/version.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/web/RNFBAppCheckModule.android.d.ts +3 -0
- package/dist/typescript/commonjs/lib/web/RNFBAppCheckModule.android.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/web/RNFBAppCheckModule.d.ts +18 -0
- package/dist/typescript/commonjs/lib/web/RNFBAppCheckModule.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/web/RNFBAppCheckModule.ios.d.ts +3 -0
- package/dist/typescript/commonjs/lib/web/RNFBAppCheckModule.ios.d.ts.map +1 -0
- package/dist/typescript/commonjs/package.json +1 -0
- package/dist/typescript/module/lib/ReactNativeFirebaseAppCheckProvider.d.ts +8 -0
- package/dist/typescript/module/lib/ReactNativeFirebaseAppCheckProvider.d.ts.map +1 -0
- package/dist/typescript/module/lib/index.d.ts +5 -0
- package/dist/typescript/module/lib/index.d.ts.map +1 -0
- package/dist/typescript/module/lib/modular.d.ts +57 -0
- package/dist/typescript/module/lib/modular.d.ts.map +1 -0
- package/dist/typescript/module/lib/namespaced.d.ts +17 -0
- package/dist/typescript/module/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/module/lib/types/appcheck.d.ts +299 -0
- package/dist/typescript/module/lib/types/appcheck.d.ts.map +1 -0
- package/dist/typescript/module/lib/version.d.ts +2 -0
- package/dist/typescript/module/lib/version.d.ts.map +1 -0
- package/dist/typescript/module/lib/web/RNFBAppCheckModule.android.d.ts +3 -0
- package/dist/typescript/module/lib/web/RNFBAppCheckModule.android.d.ts.map +1 -0
- package/dist/typescript/module/lib/web/RNFBAppCheckModule.d.ts +18 -0
- package/dist/typescript/module/lib/web/RNFBAppCheckModule.d.ts.map +1 -0
- package/dist/typescript/module/lib/web/RNFBAppCheckModule.ios.d.ts +3 -0
- package/dist/typescript/module/lib/web/RNFBAppCheckModule.ios.d.ts.map +1 -0
- package/dist/typescript/module/package.json +1 -0
- package/lib/ReactNativeFirebaseAppCheckProvider.ts +21 -0
- package/lib/index.ts +46 -0
- package/lib/modular.ts +157 -0
- package/lib/namespaced.ts +305 -0
- package/lib/types/appcheck.ts +386 -0
- package/lib/version.ts +2 -0
- package/lib/web/RNFBAppCheckModule.android.ts +4 -0
- package/lib/web/RNFBAppCheckModule.ios.ts +4 -0
- package/lib/web/RNFBAppCheckModule.ts +115 -0
- package/package.json +64 -8
- package/tsconfig.json +21 -0
- package/CHANGELOG.md +0 -773
- package/RNFBAppCheck.podspec +0 -50
- package/android/.editorconfig +0 -10
- package/android/build.gradle +0 -110
- package/android/lint.xml +0 -5
- package/android/settings.gradle +0 -1
- package/android/src/main/AndroidManifest.xml +0 -7
- package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckModule.java +0 -281
- package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckPackage.java +0 -41
- package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckProvider.java +0 -97
- package/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckProviderFactory.java +0 -67
- package/app.plugin.js +0 -1
- package/ios/RNFBAppCheck/RNFBAppCheckModule.m +0 -171
- package/ios/RNFBAppCheck/RNFBAppCheckProvider.h +0 -33
- package/ios/RNFBAppCheck/RNFBAppCheckProvider.m +0 -90
- package/ios/RNFBAppCheck/RNFBAppCheckProviderFactory.h +0 -28
- package/ios/RNFBAppCheck/RNFBAppCheckProviderFactory.m +0 -61
- package/ios/RNFBAppCheck.xcodeproj/project.pbxproj +0 -349
- package/ios/RNFBAppCheck.xcodeproj/xcshareddata/IDETemplateMacros.plist +0 -24
- package/lib/ReactNativeFirebaseAppCheckProvider.js +0 -9
- package/lib/modular/index.d.ts +0 -149
- package/lib/modular/index.js +0 -102
- package/lib/version.js +0 -2
- package/plugin/build/index.d.ts +0 -3
- package/plugin/build/index.js +0 -15
- package/plugin/build/ios/appDelegate.d.ts +0 -6
- package/plugin/build/ios/appDelegate.js +0 -137
- package/plugin/build/ios/index.d.ts +0 -2
- package/plugin/build/ios/index.js +0 -5
- package/plugin/tsconfig.tsbuildinfo +0 -1
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
#import <Firebase/Firebase.h>
|
|
19
|
-
#import <FirebaseAppCheck/FIRAppCheck.h>
|
|
20
|
-
|
|
21
|
-
#import <React/RCTUtils.h>
|
|
22
|
-
|
|
23
|
-
#import "RNFBApp/RNFBSharedUtils.h"
|
|
24
|
-
#import "RNFBAppCheckModule.h"
|
|
25
|
-
|
|
26
|
-
@implementation RNFBAppCheckModule
|
|
27
|
-
#pragma mark -
|
|
28
|
-
#pragma mark Module Setup
|
|
29
|
-
|
|
30
|
-
RCT_EXPORT_MODULE();
|
|
31
|
-
|
|
32
|
-
- (dispatch_queue_t)methodQueue {
|
|
33
|
-
return dispatch_get_main_queue();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
+ (instancetype)sharedInstance {
|
|
37
|
-
static dispatch_once_t once;
|
|
38
|
-
__strong static RNFBAppCheckModule *sharedInstance;
|
|
39
|
-
dispatch_once(&once, ^{
|
|
40
|
-
sharedInstance = [[RNFBAppCheckModule alloc] init];
|
|
41
|
-
sharedInstance.providerFactory = [[RNFBAppCheckProviderFactory alloc] init];
|
|
42
|
-
[FIRAppCheck setAppCheckProviderFactory:sharedInstance.providerFactory];
|
|
43
|
-
});
|
|
44
|
-
return sharedInstance;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
#pragma mark -
|
|
48
|
-
#pragma mark Firebase AppCheck Methods
|
|
49
|
-
|
|
50
|
-
RCT_EXPORT_METHOD(activate
|
|
51
|
-
: (FIRApp *)firebaseApp
|
|
52
|
-
: (nonnull NSString *)siteKeyOrProvider
|
|
53
|
-
: (BOOL)isTokenAutoRefreshEnabled
|
|
54
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
55
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
56
|
-
DLog(@"deprecated API, provider will be deviceCheck / token refresh %d for app %@",
|
|
57
|
-
isTokenAutoRefreshEnabled, firebaseApp.name);
|
|
58
|
-
[[RNFBAppCheckModule sharedInstance].providerFactory configure:firebaseApp
|
|
59
|
-
providerName:@"deviceCheck"
|
|
60
|
-
debugToken:nil];
|
|
61
|
-
|
|
62
|
-
FIRAppCheck *appCheck = [FIRAppCheck appCheckWithApp:firebaseApp];
|
|
63
|
-
appCheck.isTokenAutoRefreshEnabled = isTokenAutoRefreshEnabled;
|
|
64
|
-
resolve([NSNull null]);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
RCT_EXPORT_METHOD(configureProvider
|
|
68
|
-
: (FIRApp *)firebaseApp
|
|
69
|
-
: (nonnull NSString *)providerName
|
|
70
|
-
: (nullable NSString *)debugToken
|
|
71
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
72
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
73
|
-
DLog(@"appName/providerName/debugToken: %@/%@/%@", firebaseApp.name, providerName,
|
|
74
|
-
(debugToken == nil ? @"null" : @"(not shown)"));
|
|
75
|
-
[[RNFBAppCheckModule sharedInstance].providerFactory configure:firebaseApp
|
|
76
|
-
providerName:providerName
|
|
77
|
-
debugToken:debugToken];
|
|
78
|
-
resolve([NSNull null]);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
RCT_EXPORT_METHOD(setTokenAutoRefreshEnabled
|
|
82
|
-
: (FIRApp *)firebaseApp
|
|
83
|
-
: (BOOL)isTokenAutoRefreshEnabled) {
|
|
84
|
-
DLog(@"app/isTokenAutoRefreshEnabled: %@/%d", firebaseApp.name, isTokenAutoRefreshEnabled);
|
|
85
|
-
FIRAppCheck *appCheck = [FIRAppCheck appCheckWithApp:firebaseApp];
|
|
86
|
-
appCheck.isTokenAutoRefreshEnabled = isTokenAutoRefreshEnabled;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Not present in JS or Android - it is iOS-specific so we only call this in testing - it is not in
|
|
90
|
-
// index.d.ts
|
|
91
|
-
RCT_EXPORT_METHOD(isTokenAutoRefreshEnabled
|
|
92
|
-
: (FIRApp *)firebaseApp
|
|
93
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
94
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
95
|
-
FIRAppCheck *appCheck = [FIRAppCheck appCheckWithApp:firebaseApp];
|
|
96
|
-
BOOL isTokenAutoRefreshEnabled = appCheck.isTokenAutoRefreshEnabled;
|
|
97
|
-
DLog(@"app/isTokenAutoRefreshEnabled: %@/%d", firebaseApp.name, isTokenAutoRefreshEnabled);
|
|
98
|
-
resolve([NSNumber numberWithBool:isTokenAutoRefreshEnabled]);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
RCT_EXPORT_METHOD(getToken
|
|
102
|
-
: (FIRApp *)firebaseApp
|
|
103
|
-
: (BOOL)forceRefresh
|
|
104
|
-
: (RCTPromiseResolveBlock)resolve
|
|
105
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
106
|
-
FIRAppCheck *appCheck = [FIRAppCheck appCheckWithApp:firebaseApp];
|
|
107
|
-
DLog(@"appName %@", firebaseApp.name);
|
|
108
|
-
[appCheck
|
|
109
|
-
tokenForcingRefresh:forceRefresh
|
|
110
|
-
completion:^(FIRAppCheckToken *_Nullable token, NSError *_Nullable error) {
|
|
111
|
-
if (error != nil) {
|
|
112
|
-
// Handle any errors if the token was not retrieved.
|
|
113
|
-
DLog(@"RNFBAppCheck - getToken - Unable to retrieve App Check token: %@", error);
|
|
114
|
-
[RNFBSharedUtils rejectPromiseWithUserInfo:reject
|
|
115
|
-
userInfo:(NSMutableDictionary *)@{
|
|
116
|
-
@"code" : @"token-error",
|
|
117
|
-
@"message" : [error localizedDescription],
|
|
118
|
-
}];
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (token == nil) {
|
|
122
|
-
DLog(@"RNFBAppCheck - getToken - Unable to retrieve App Check token.");
|
|
123
|
-
[RNFBSharedUtils rejectPromiseWithUserInfo:reject
|
|
124
|
-
userInfo:(NSMutableDictionary *)@{
|
|
125
|
-
@"code" : @"token-null",
|
|
126
|
-
@"message" : @"no token fetched",
|
|
127
|
-
}];
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
NSMutableDictionary *tokenResultDictionary = [NSMutableDictionary new];
|
|
132
|
-
tokenResultDictionary[@"token"] = token.token;
|
|
133
|
-
resolve(tokenResultDictionary);
|
|
134
|
-
}];
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
RCT_EXPORT_METHOD(getLimitedUseToken
|
|
138
|
-
: (FIRApp *)firebaseApp
|
|
139
|
-
: (RCTPromiseResolveBlock)resolve
|
|
140
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
141
|
-
FIRAppCheck *appCheck = [FIRAppCheck appCheckWithApp:firebaseApp];
|
|
142
|
-
DLog(@"appName %@", firebaseApp.name);
|
|
143
|
-
[appCheck limitedUseTokenWithCompletion:^(FIRAppCheckToken *_Nullable token,
|
|
144
|
-
NSError *_Nullable error) {
|
|
145
|
-
if (error != nil) {
|
|
146
|
-
// Handle any errors if the token was not retrieved.
|
|
147
|
-
DLog(@"RNFBAppCheck - getLimitedUseToken - Unable to retrieve App Check token: %@", error);
|
|
148
|
-
[RNFBSharedUtils rejectPromiseWithUserInfo:reject
|
|
149
|
-
userInfo:(NSMutableDictionary *)@{
|
|
150
|
-
@"code" : @"token-error",
|
|
151
|
-
@"message" : [error localizedDescription],
|
|
152
|
-
}];
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (token == nil) {
|
|
156
|
-
DLog(@"RNFBAppCheck - getLimitedUseToken - Unable to retrieve App Check token.");
|
|
157
|
-
[RNFBSharedUtils rejectPromiseWithUserInfo:reject
|
|
158
|
-
userInfo:(NSMutableDictionary *)@{
|
|
159
|
-
@"code" : @"token-null",
|
|
160
|
-
@"message" : @"no token fetched",
|
|
161
|
-
}];
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
NSMutableDictionary *tokenResultDictionary = [NSMutableDictionary new];
|
|
166
|
-
tokenResultDictionary[@"token"] = token.token;
|
|
167
|
-
resolve(tokenResultDictionary);
|
|
168
|
-
}];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
#import <Firebase/Firebase.h>
|
|
19
|
-
#import <FirebaseAppCheck/FIRAppCheck.h>
|
|
20
|
-
|
|
21
|
-
@interface RNFBAppCheckProvider : NSObject <FIRAppCheckProvider>
|
|
22
|
-
|
|
23
|
-
@property FIRApp *app;
|
|
24
|
-
|
|
25
|
-
@property id<FIRAppCheckProvider> delegateProvider;
|
|
26
|
-
|
|
27
|
-
- (void)configure:(FIRApp *)app
|
|
28
|
-
providerName:(NSString *)providerName
|
|
29
|
-
debugToken:(NSString *)debugToken;
|
|
30
|
-
|
|
31
|
-
- (id)initWithApp:(FIRApp *)app;
|
|
32
|
-
|
|
33
|
-
@end
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
#import "RNFBAppCheckProvider.h"
|
|
18
|
-
#import "RNFBApp/RNFBSharedUtils.h"
|
|
19
|
-
|
|
20
|
-
@implementation RNFBAppCheckProvider
|
|
21
|
-
|
|
22
|
-
- (id)initWithApp:app {
|
|
23
|
-
DLog(@"RNFBAppCheck init with app %@", [app name]);
|
|
24
|
-
self = [super init];
|
|
25
|
-
if (self) {
|
|
26
|
-
self.app = app;
|
|
27
|
-
}
|
|
28
|
-
return self;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
- (void)configure:(FIRApp *)app
|
|
32
|
-
providerName:(NSString *)providerName
|
|
33
|
-
debugToken:(NSString *)debugToken {
|
|
34
|
-
DLog(@"appName/providerName/debugToken: %@/%@/%@", app.name, providerName,
|
|
35
|
-
(debugToken == nil ? @"null" : @"(not shown)"));
|
|
36
|
-
|
|
37
|
-
DLog(@"appName %@", app.name);
|
|
38
|
-
|
|
39
|
-
// - determine if debugToken is provided via nullable arg
|
|
40
|
-
if ([providerName isEqualToString:@"debug"]) {
|
|
41
|
-
// The firebase-ios-sdk debug app check provider will take a token from environment if it
|
|
42
|
-
// exists:
|
|
43
|
-
if (debugToken != nil) {
|
|
44
|
-
// We have a debug token, so just need to stuff it in the environment and it will hook up
|
|
45
|
-
char *key = "FIRAAppCheckDebugToken", *value = (char *)[debugToken UTF8String];
|
|
46
|
-
int overwrite = 1;
|
|
47
|
-
setenv(key, value, overwrite);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
self.delegateProvider = [[FIRAppCheckDebugProvider alloc] initWithApp:app];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if ([providerName isEqualToString:@"deviceCheck"]) {
|
|
54
|
-
self.delegateProvider = [[FIRDeviceCheckProvider alloc] initWithApp:app];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if ([providerName isEqualToString:@"appAttest"]) {
|
|
58
|
-
if (@available(iOS 14.0, macOS 11.0, macCatalyst 14.0, tvOS 15.0, watchOS 9.0, *)) {
|
|
59
|
-
self.delegateProvider = [[FIRAppAttestProvider alloc] initWithApp:app];
|
|
60
|
-
} else {
|
|
61
|
-
// This is not a valid configuration.
|
|
62
|
-
DLog(@"AppAttest unavailable: it requires iOS14+, macOS 11+, macCatalyst14+ or tvOS15+. "
|
|
63
|
-
@"Installing "
|
|
64
|
-
@"debug provider to guarantee invalid tokens in this invalid configuration.");
|
|
65
|
-
self.delegateProvider = [[FIRAppCheckDebugProvider alloc] initWithApp:app];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if ([providerName isEqualToString:@"appAttestWithDeviceCheckFallback"]) {
|
|
70
|
-
if (@available(iOS 14.0, macOS 11.0, macCatalyst 14.0, tvOS 15.0, watchOS 9.0, *)) {
|
|
71
|
-
self.delegateProvider = [[FIRAppAttestProvider alloc] initWithApp:app];
|
|
72
|
-
} else {
|
|
73
|
-
self.delegateProvider = [[FIRDeviceCheckProvider alloc] initWithApp:app];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
- (void)getTokenWithCompletion:(nonnull void (^)(FIRAppCheckToken *_Nullable,
|
|
79
|
-
NSError *_Nullable))handler {
|
|
80
|
-
DLog(@"proxying getTokenWithCompletion to delegateProvider...");
|
|
81
|
-
[self.delegateProvider getTokenWithCompletion:handler];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
- (void)getLimitedUseTokenWithCompletion:(nonnull void (^)(FIRAppCheckToken *_Nullable,
|
|
85
|
-
NSError *_Nullable))handler {
|
|
86
|
-
DLog(@"proxying getLimitedUseTokenWithCompletion to delegateProvider...");
|
|
87
|
-
[self.delegateProvider getLimitedUseTokenWithCompletion:handler];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
#import "RNFBAppCheckProvider.h"
|
|
19
|
-
|
|
20
|
-
@interface RNFBAppCheckProviderFactory : NSObject <FIRAppCheckProviderFactory>
|
|
21
|
-
|
|
22
|
-
@property NSMutableDictionary *_Nullable providers;
|
|
23
|
-
|
|
24
|
-
- (void)configure:(FIRApp *_Nonnull)app
|
|
25
|
-
providerName:(NSString *_Nonnull)providerName
|
|
26
|
-
debugToken:(NSString *_Nullable)debugToken;
|
|
27
|
-
|
|
28
|
-
@end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
#import "RNFBAppCheckProviderFactory.h"
|
|
19
|
-
#import "RNFBApp/RNFBSharedUtils.h"
|
|
20
|
-
|
|
21
|
-
@implementation RNFBAppCheckProviderFactory
|
|
22
|
-
|
|
23
|
-
- (nullable id<FIRAppCheckProvider>)createProviderWithApp:(FIRApp *)app {
|
|
24
|
-
DLog(@"appName %@", app.name);
|
|
25
|
-
|
|
26
|
-
// The SDK may try to call this before we have been configured,
|
|
27
|
-
// so we will configure ourselves and set the provider up as a default to start
|
|
28
|
-
// pre-configure
|
|
29
|
-
if (self.providers == nil) {
|
|
30
|
-
DLog(@"providers dictionary initializing for app %@", app.name);
|
|
31
|
-
self.providers = [NSMutableDictionary new];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (self.providers[app.name] == nil) {
|
|
35
|
-
DLog(@"provider initializing (with default to debug) for app %@", app.name);
|
|
36
|
-
self.providers[app.name] = [RNFBAppCheckProvider new];
|
|
37
|
-
RNFBAppCheckProvider *provider = self.providers[app.name];
|
|
38
|
-
[provider configure:app providerName:@"debug" debugToken:nil];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return self.providers[app.name];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
- (void)configure:(FIRApp *)app
|
|
45
|
-
providerName:(NSString *)providerName
|
|
46
|
-
debugToken:(NSString *)debugToken {
|
|
47
|
-
DLog(@"appName/providerName/debugToken: %@/%@/%@", app.name, providerName,
|
|
48
|
-
(debugToken == nil ? @"null" : @"(not shown)"));
|
|
49
|
-
if (self.providers == nil) {
|
|
50
|
-
self.providers = [NSMutableDictionary new];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (self.providers[app.name] == nil) {
|
|
54
|
-
self.providers[app.name] = [RNFBAppCheckProvider new];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
RNFBAppCheckProvider *provider = self.providers[app.name];
|
|
58
|
-
[provider configure:app providerName:providerName debugToken:debugToken];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@end
|