react-native-authsignal 0.1.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.
@@ -0,0 +1,37 @@
1
+ <!--suppress AndroidElementNotAllowed -->
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools"
4
+ package="com.authsignal.react">
5
+ <uses-permission android:name="android.permission.INTERNET" />
6
+
7
+ <application>
8
+ <activity
9
+ android:name="com.authsignal.react.AuthenticationActivity"
10
+ android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
11
+ android:exported="false"
12
+ android:launchMode="singleTask"
13
+ android:theme="@android:style/Theme.Translucent.NoTitleBar" />
14
+
15
+ <activity
16
+ android:name="com.authsignal.react.RedirectActivity"
17
+ android:exported="true">
18
+ <intent-filter android:autoVerify="true"
19
+ tools:targetApi="m">
20
+ <action android:name="android.intent.action.VIEW" />
21
+
22
+ <category android:name="android.intent.category.DEFAULT" />
23
+ <category android:name="android.intent.category.BROWSABLE" />
24
+
25
+ <data android:host="auth" android:scheme="authsignal" />
26
+ </intent-filter>
27
+ </activity>
28
+ </application>
29
+
30
+ <queries>
31
+ <intent>
32
+ <action android:name="android.intent.action.VIEW" />
33
+ <category android:name="android.intent.category.BROWSABLE" />
34
+ <data android:scheme="https" />
35
+ </intent>
36
+ </queries>
37
+ </manifest>
@@ -0,0 +1,73 @@
1
+ package com.authsignal.react;
2
+
3
+ import android.app.Activity;
4
+ import android.content.Intent;
5
+ import android.net.Uri;
6
+ import android.os.Bundle;
7
+
8
+ import androidx.annotation.NonNull;
9
+ import androidx.annotation.Nullable;
10
+ import androidx.browser.customtabs.CustomTabsIntent;
11
+
12
+ public class AuthenticationActivity extends Activity {
13
+ static final int AUTHENTICATION_REQUEST = 1000;
14
+ static final String EXTRA_AUTHORIZE_URI = "com.authsignal.react.EXTRA_AUTHORIZE_URI";
15
+ private static final String EXTRA_INTENT_LAUNCHED = "com.authsignal.react.EXTRA_INTENT_LAUNCHED";
16
+
17
+ private boolean intentLaunched;
18
+
19
+ static void authenticateUsingBrowser(@NonNull Activity activity, @NonNull Uri authorizeUri) {
20
+ Intent intent = new Intent(activity, AuthenticationActivity.class);
21
+ intent.putExtra(AuthenticationActivity.EXTRA_AUTHORIZE_URI, authorizeUri);
22
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
23
+ activity.startActivityForResult(intent, AUTHENTICATION_REQUEST);
24
+ }
25
+
26
+ @Override
27
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
28
+ super.onCreate(savedInstanceState);
29
+ if (savedInstanceState != null) {
30
+ intentLaunched = savedInstanceState.getBoolean(EXTRA_INTENT_LAUNCHED, false);
31
+ }
32
+ }
33
+
34
+ @Override
35
+ protected void onResume() {
36
+ super.onResume();
37
+ final Intent authenticationIntent = getIntent();
38
+
39
+ if (!intentLaunched && authenticationIntent.getExtras() == null) {
40
+ finish();
41
+ return;
42
+ } else if (!intentLaunched) {
43
+ intentLaunched = true;
44
+ launchAuthenticationIntent();
45
+ return;
46
+ }
47
+
48
+ boolean resultMissing = authenticationIntent.getData() == null;
49
+ if (resultMissing) setResult(RESULT_CANCELED);
50
+ else setResult(RESULT_OK, authenticationIntent);
51
+ finish();
52
+ }
53
+
54
+ @Override
55
+ protected void onSaveInstanceState(@NonNull Bundle outState) {
56
+ super.onSaveInstanceState(outState);
57
+ outState.putBoolean(EXTRA_INTENT_LAUNCHED, intentLaunched);
58
+ }
59
+
60
+ @Override
61
+ protected void onNewIntent(@Nullable Intent intent) {
62
+ super.onNewIntent(intent);
63
+ setIntent(intent);
64
+ }
65
+
66
+ private void launchAuthenticationIntent() {
67
+ Bundle extras = getIntent().getExtras();
68
+ Uri authorizeUri = extras.getParcelable(EXTRA_AUTHORIZE_URI);
69
+ CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
70
+ CustomTabsIntent customTabsIntent = builder.build();
71
+ customTabsIntent.launchUrl(this, authorizeUri);
72
+ }
73
+ }
@@ -0,0 +1,118 @@
1
+ package com.authsignal.react;
2
+
3
+ import android.app.Activity;
4
+ import android.content.Intent;
5
+ import android.content.ActivityNotFoundException;
6
+ import android.net.Uri;
7
+ import androidx.annotation.NonNull;
8
+
9
+ import com.facebook.react.bridge.ActivityEventListener;
10
+ import com.facebook.react.bridge.Arguments;
11
+ import com.facebook.react.bridge.Callback;
12
+ import com.facebook.react.bridge.ReactApplicationContext;
13
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
14
+ import com.facebook.react.bridge.ReactMethod;
15
+ import com.facebook.react.bridge.WritableMap;
16
+
17
+ import java.net.URL;
18
+ import java.net.URLDecoder;
19
+ import java.util.HashMap;
20
+ import java.util.Map;
21
+ import java.util.Objects;
22
+
23
+ import static android.app.Activity.RESULT_OK;
24
+
25
+ public class AuthsignalModule extends ReactContextBaseJavaModule implements ActivityEventListener {
26
+ private final ReactApplicationContext reactContext;
27
+ private Callback callback;
28
+
29
+ public AuthsignalModule(ReactApplicationContext reactContext) {
30
+ super(reactContext);
31
+ this.reactContext = reactContext;
32
+ this.reactContext.addActivityEventListener(this);
33
+ }
34
+
35
+ @Override
36
+ public Map<String, Object> getConstants() {
37
+ final Map<String, Object> constants = new HashMap<>();
38
+ constants.put("bundleIdentifier", reactContext.getApplicationInfo().packageName);
39
+ return constants;
40
+ }
41
+
42
+ @NonNull
43
+ @Override
44
+ public String getName() {
45
+ return "Authsignal";
46
+ }
47
+
48
+ @ReactMethod
49
+ public void launch(String url, Callback callback) {
50
+ final Activity activity = getCurrentActivity();
51
+ final Uri parsedUrl = Uri.parse(url);
52
+ this.callback = callback;
53
+
54
+ try {
55
+ if (activity != null) {
56
+ AuthenticationActivity.authenticateUsingBrowser(activity, parsedUrl);
57
+ } else {
58
+ final WritableMap error = Arguments.createMap();
59
+ error.putString("error", "activity_not_available");
60
+ error.putString("error_description", "Android Activity is null.");
61
+ callback.invoke(error);
62
+ }
63
+ } catch (ActivityNotFoundException e){
64
+ final WritableMap error = Arguments.createMap();
65
+ error.putString("error", "browser_not_available");
66
+ error.putString("error_description", "No browser app is installed");
67
+ callback.invoke(error);
68
+ }
69
+ }
70
+
71
+ @Override
72
+ public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
73
+ Callback cb = AuthsignalModule.this.callback;
74
+
75
+ if (cb == null) {
76
+ return;
77
+ }
78
+
79
+ boolean hasResult = resultCode == RESULT_OK &&
80
+ requestCode == AuthenticationActivity.AUTHENTICATION_REQUEST &&
81
+ data.getData() != null;
82
+
83
+ if (hasResult) {
84
+ try {
85
+ String redirectUrl = data.getData().toString();
86
+ String query = redirectUrl.split("[?]")[1];
87
+ String[] pairs = query.split("&");
88
+ String token = null;
89
+ for (String pair : pairs) {
90
+ int index = pair.indexOf("=");
91
+ String name = URLDecoder.decode(pair.substring(0, index), "UTF-8");
92
+ String value = URLDecoder.decode(pair.substring(index + 1), "UTF-8");
93
+ if (name.equals("token")) {
94
+ token = value;
95
+ }
96
+ }
97
+ cb.invoke(null, token);
98
+ } catch (Exception ex) {
99
+ final WritableMap error = Arguments.createMap();
100
+ error.putString("error", "malformed_url");
101
+ error.putString("error_description", "Malformed redirect url");
102
+ cb.invoke(error);
103
+ }
104
+
105
+ } else {
106
+ final WritableMap error = Arguments.createMap();
107
+ error.putString("error", "user_cancelled");
108
+ error.putString("error_description", "User cancelled");
109
+ cb.invoke(error);
110
+ }
111
+
112
+ AuthsignalModule.this.callback = null;
113
+ }
114
+
115
+ @Override
116
+ public void onNewIntent(Intent intent) {
117
+ }
118
+ }
@@ -0,0 +1,22 @@
1
+ package com.authsignal.react;
2
+
3
+ import java.util.Arrays;
4
+ import java.util.Collections;
5
+ import java.util.List;
6
+
7
+ import com.facebook.react.ReactPackage;
8
+ import com.facebook.react.bridge.NativeModule;
9
+ import com.facebook.react.bridge.ReactApplicationContext;
10
+ import com.facebook.react.uimanager.ViewManager;
11
+
12
+ public class AuthsignalPackage implements ReactPackage {
13
+ @Override
14
+ public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
15
+ return Arrays.<NativeModule>asList(new AuthsignalModule(reactContext));
16
+ }
17
+
18
+ @Override
19
+ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
20
+ return Collections.emptyList();
21
+ }
22
+ }
@@ -0,0 +1,18 @@
1
+ package com.authsignal.react;
2
+
3
+ import android.app.Activity;
4
+ import android.content.Intent;
5
+ import android.os.Bundle;
6
+ import androidx.annotation.Nullable;
7
+
8
+ public class RedirectActivity extends Activity {
9
+ @Override
10
+ public void onCreate(@Nullable Bundle savedInstanceBundle) {
11
+ super.onCreate(savedInstanceBundle);
12
+ Intent intent = new Intent(this, AuthenticationActivity.class);
13
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
14
+ if (getIntent() != null) intent.setData(getIntent().getData());
15
+ startActivity(intent);
16
+ finish();
17
+ }
18
+ }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: ['module:metro-react-native-babel-preset'],
3
+ };
@@ -0,0 +1,12 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @import AuthenticationServices;
4
+
5
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
6
+ @interface Authsignal : NSObject <RCTBridgeModule, ASWebAuthenticationPresentationContextProviding>
7
+ @end
8
+ #else
9
+ @interface Authsignal : NSObject <RCTBridgeModule>
10
+ @end
11
+ #endif
12
+
@@ -0,0 +1,68 @@
1
+ #import "Authsignal.h"
2
+ #import <React/RCTConvert.h>
3
+
4
+ @interface Authsignal ()
5
+ @property (strong, nonatomic) NSObject *session;
6
+ @end
7
+
8
+ @implementation Authsignal
9
+
10
+ RCT_EXPORT_MODULE();
11
+
12
+ - (dispatch_queue_t)methodQueue
13
+ {
14
+ return dispatch_get_main_queue();
15
+ }
16
+
17
+ RCT_EXPORT_METHOD(launch:(NSString *)url resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
18
+ {
19
+ NSURL *authUrl = [RCTConvert NSURL:url];
20
+ NSString *scheme = @"authsignal";
21
+
22
+ ASWebAuthenticationSession* authenticationSession = [[ASWebAuthenticationSession alloc] initWithURL:authUrl
23
+ callbackURLScheme:scheme
24
+ completionHandler:^(NSURL * _Nullable callbackURL,
25
+ NSError * _Nullable error) {
26
+ if (callbackURL) {
27
+ NSURLComponents *components = [[NSURLComponents alloc] initWithString:callbackURL.absoluteString];
28
+ NSString *token;
29
+
30
+ for (NSURLQueryItem *item in components.queryItems) {
31
+ if ([item.name isEqualToString:@"token"]) {
32
+ token = item.value;
33
+ }
34
+ }
35
+
36
+ resolve(token);
37
+ } else if (error) {
38
+ if ([[error domain] isEqualToString:ASWebAuthenticationSessionErrorDomain] &&
39
+ [error code] == ASWebAuthenticationSessionErrorCodeCanceledLogin) {
40
+ resolve(nil);
41
+ } else {
42
+ reject(@"AS_ERROR", error.description, nil);
43
+ }
44
+ }
45
+
46
+ self.session = nil;
47
+ }];
48
+
49
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
50
+ if (@available(iOS 13, *)) {
51
+ authenticationSession.presentationContextProvider = self;
52
+ authenticationSession.prefersEphemeralWebBrowserSession = NO;
53
+ }
54
+ #endif
55
+
56
+ self.session = authenticationSession;
57
+
58
+ [(ASWebAuthenticationSession*) self.session start];
59
+ }
60
+
61
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
62
+ - (ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(ASWebAuthenticationSession *)session API_AVAILABLE(ios(13.0)){
63
+ return UIApplication.sharedApplication.keyWindow;
64
+ }
65
+ #endif
66
+
67
+ @end
68
+
@@ -0,0 +1,274 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXCopyFilesBuildPhase section */
10
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
11
+ isa = PBXCopyFilesBuildPhase;
12
+ buildActionMask = 2147483647;
13
+ dstPath = "include/$(PRODUCT_NAME)";
14
+ dstSubfolderSpec = 16;
15
+ files = (
16
+ );
17
+ runOnlyForDeploymentPostprocessing = 0;
18
+ };
19
+ /* End PBXCopyFilesBuildPhase section */
20
+
21
+ /* Begin PBXFileReference section */
22
+ 134814201AA4EA6300B7C361 /* libAuthsignal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAuthsignal.a; sourceTree = BUILT_PRODUCTS_DIR; };
23
+ B3E7B5891CC2AC0600A0062D /* Authsignal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Authsignal.m; sourceTree = "<group>"; };
24
+ D8CCAF332908C7A30040E0F0 /* Authsignal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Authsignal.h; sourceTree = "<group>"; };
25
+ /* End PBXFileReference section */
26
+
27
+ /* Begin PBXFrameworksBuildPhase section */
28
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
29
+ isa = PBXFrameworksBuildPhase;
30
+ buildActionMask = 2147483647;
31
+ files = (
32
+ );
33
+ runOnlyForDeploymentPostprocessing = 0;
34
+ };
35
+ /* End PBXFrameworksBuildPhase section */
36
+
37
+ /* Begin PBXGroup section */
38
+ 134814211AA4EA7D00B7C361 /* Products */ = {
39
+ isa = PBXGroup;
40
+ children = (
41
+ 134814201AA4EA6300B7C361 /* libAuthsignal.a */,
42
+ );
43
+ name = Products;
44
+ sourceTree = "<group>";
45
+ };
46
+ 58B511D21A9E6C8500147676 = {
47
+ isa = PBXGroup;
48
+ children = (
49
+ D8CCAF332908C7A30040E0F0 /* Authsignal.h */,
50
+ B3E7B5891CC2AC0600A0062D /* Authsignal.m */,
51
+ 134814211AA4EA7D00B7C361 /* Products */,
52
+ );
53
+ sourceTree = "<group>";
54
+ };
55
+ /* End PBXGroup section */
56
+
57
+ /* Begin PBXNativeTarget section */
58
+ 58B511DA1A9E6C8500147676 /* Authsignal */ = {
59
+ isa = PBXNativeTarget;
60
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Authsignal" */;
61
+ buildPhases = (
62
+ 58B511D71A9E6C8500147676 /* Sources */,
63
+ 58B511D81A9E6C8500147676 /* Frameworks */,
64
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
65
+ );
66
+ buildRules = (
67
+ );
68
+ dependencies = (
69
+ );
70
+ name = Authsignal;
71
+ productName = RCTDataManager;
72
+ productReference = 134814201AA4EA6300B7C361 /* libAuthsignal.a */;
73
+ productType = "com.apple.product-type.library.static";
74
+ };
75
+ /* End PBXNativeTarget section */
76
+
77
+ /* Begin PBXProject section */
78
+ 58B511D31A9E6C8500147676 /* Project object */ = {
79
+ isa = PBXProject;
80
+ attributes = {
81
+ LastUpgradeCheck = 0920;
82
+ ORGANIZATIONNAME = Facebook;
83
+ TargetAttributes = {
84
+ 58B511DA1A9E6C8500147676 = {
85
+ CreatedOnToolsVersion = 6.1.1;
86
+ };
87
+ };
88
+ };
89
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Authsignal" */;
90
+ compatibilityVersion = "Xcode 3.2";
91
+ developmentRegion = English;
92
+ hasScannedForEncodings = 0;
93
+ knownRegions = (
94
+ English,
95
+ en,
96
+ );
97
+ mainGroup = 58B511D21A9E6C8500147676;
98
+ productRefGroup = 58B511D21A9E6C8500147676;
99
+ projectDirPath = "";
100
+ projectRoot = "";
101
+ targets = (
102
+ 58B511DA1A9E6C8500147676 /* Authsignal */,
103
+ );
104
+ };
105
+ /* End PBXProject section */
106
+
107
+ /* Begin PBXSourcesBuildPhase section */
108
+ 58B511D71A9E6C8500147676 /* Sources */ = {
109
+ isa = PBXSourcesBuildPhase;
110
+ buildActionMask = 2147483647;
111
+ files = (
112
+ );
113
+ runOnlyForDeploymentPostprocessing = 0;
114
+ };
115
+ /* End PBXSourcesBuildPhase section */
116
+
117
+ /* Begin XCBuildConfiguration section */
118
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
119
+ isa = XCBuildConfiguration;
120
+ buildSettings = {
121
+ ALWAYS_SEARCH_USER_PATHS = NO;
122
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
123
+ CLANG_CXX_LIBRARY = "libc++";
124
+ CLANG_ENABLE_MODULES = YES;
125
+ CLANG_ENABLE_OBJC_ARC = YES;
126
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
127
+ CLANG_WARN_BOOL_CONVERSION = YES;
128
+ CLANG_WARN_COMMA = YES;
129
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
130
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
131
+ CLANG_WARN_EMPTY_BODY = YES;
132
+ CLANG_WARN_ENUM_CONVERSION = YES;
133
+ CLANG_WARN_INFINITE_RECURSION = YES;
134
+ CLANG_WARN_INT_CONVERSION = YES;
135
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
136
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
137
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
138
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
139
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
140
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
141
+ CLANG_WARN_UNREACHABLE_CODE = YES;
142
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
143
+ COPY_PHASE_STRIP = NO;
144
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
145
+ ENABLE_TESTABILITY = YES;
146
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
147
+ GCC_C_LANGUAGE_STANDARD = gnu99;
148
+ GCC_DYNAMIC_NO_PIC = NO;
149
+ GCC_NO_COMMON_BLOCKS = YES;
150
+ GCC_OPTIMIZATION_LEVEL = 0;
151
+ GCC_PREPROCESSOR_DEFINITIONS = (
152
+ "DEBUG=1",
153
+ "$(inherited)",
154
+ );
155
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
156
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
157
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
158
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
159
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
160
+ GCC_WARN_UNUSED_FUNCTION = YES;
161
+ GCC_WARN_UNUSED_VARIABLE = YES;
162
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
163
+ MTL_ENABLE_DEBUG_INFO = YES;
164
+ ONLY_ACTIVE_ARCH = YES;
165
+ SDKROOT = iphoneos;
166
+ };
167
+ name = Debug;
168
+ };
169
+ 58B511EE1A9E6C8500147676 /* Release */ = {
170
+ isa = XCBuildConfiguration;
171
+ buildSettings = {
172
+ ALWAYS_SEARCH_USER_PATHS = NO;
173
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
174
+ CLANG_CXX_LIBRARY = "libc++";
175
+ CLANG_ENABLE_MODULES = YES;
176
+ CLANG_ENABLE_OBJC_ARC = YES;
177
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
178
+ CLANG_WARN_BOOL_CONVERSION = YES;
179
+ CLANG_WARN_COMMA = YES;
180
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
181
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
182
+ CLANG_WARN_EMPTY_BODY = YES;
183
+ CLANG_WARN_ENUM_CONVERSION = YES;
184
+ CLANG_WARN_INFINITE_RECURSION = YES;
185
+ CLANG_WARN_INT_CONVERSION = YES;
186
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
187
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
188
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
189
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
190
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
191
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
192
+ CLANG_WARN_UNREACHABLE_CODE = YES;
193
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
194
+ COPY_PHASE_STRIP = YES;
195
+ ENABLE_NS_ASSERTIONS = NO;
196
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
197
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
198
+ GCC_C_LANGUAGE_STANDARD = gnu99;
199
+ GCC_NO_COMMON_BLOCKS = YES;
200
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
201
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
202
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
203
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
204
+ GCC_WARN_UNUSED_FUNCTION = YES;
205
+ GCC_WARN_UNUSED_VARIABLE = YES;
206
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
207
+ MTL_ENABLE_DEBUG_INFO = NO;
208
+ SDKROOT = iphoneos;
209
+ VALIDATE_PRODUCT = YES;
210
+ };
211
+ name = Release;
212
+ };
213
+ 58B511F01A9E6C8500147676 /* Debug */ = {
214
+ isa = XCBuildConfiguration;
215
+ buildSettings = {
216
+ HEADER_SEARCH_PATHS = (
217
+ "$(inherited)",
218
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
219
+ "$(SRCROOT)/../../../React/**",
220
+ "$(SRCROOT)/../../react-native/React/**",
221
+ );
222
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
223
+ OTHER_LDFLAGS = "-ObjC";
224
+ PRODUCT_NAME = Authsignal;
225
+ SKIP_INSTALL = YES;
226
+ SWIFT_OBJC_BRIDGING_HEADER = "Authsignal-Bridging-Header.h";
227
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
228
+ SWIFT_VERSION = 5.0;
229
+ };
230
+ name = Debug;
231
+ };
232
+ 58B511F11A9E6C8500147676 /* Release */ = {
233
+ isa = XCBuildConfiguration;
234
+ buildSettings = {
235
+ HEADER_SEARCH_PATHS = (
236
+ "$(inherited)",
237
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
238
+ "$(SRCROOT)/../../../React/**",
239
+ "$(SRCROOT)/../../react-native/React/**",
240
+ );
241
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
242
+ OTHER_LDFLAGS = "-ObjC";
243
+ PRODUCT_NAME = Authsignal;
244
+ SKIP_INSTALL = YES;
245
+ SWIFT_OBJC_BRIDGING_HEADER = "Authsignal-Bridging-Header.h";
246
+ SWIFT_VERSION = 5.0;
247
+ };
248
+ name = Release;
249
+ };
250
+ /* End XCBuildConfiguration section */
251
+
252
+ /* Begin XCConfigurationList section */
253
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Authsignal" */ = {
254
+ isa = XCConfigurationList;
255
+ buildConfigurations = (
256
+ 58B511ED1A9E6C8500147676 /* Debug */,
257
+ 58B511EE1A9E6C8500147676 /* Release */,
258
+ );
259
+ defaultConfigurationIsVisible = 0;
260
+ defaultConfigurationName = Release;
261
+ };
262
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Authsignal" */ = {
263
+ isa = XCConfigurationList;
264
+ buildConfigurations = (
265
+ 58B511F01A9E6C8500147676 /* Debug */,
266
+ 58B511F11A9E6C8500147676 /* Release */,
267
+ );
268
+ defaultConfigurationIsVisible = 0;
269
+ defaultConfigurationName = Release;
270
+ };
271
+ /* End XCConfigurationList section */
272
+ };
273
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
274
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.launch = launch;
7
+ var _reactNative = require("react-native");
8
+ const LINKING_ERROR = `The package 'react-native-authsignal' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
9
+ ios: "- You have run 'pod install'\n",
10
+ default: ''
11
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
12
+ const Authsignal = _reactNative.NativeModules.Authsignal ? _reactNative.NativeModules.Authsignal : new Proxy({}, {
13
+ get() {
14
+ throw new Error(LINKING_ERROR);
15
+ }
16
+ });
17
+ function launch(url) {
18
+ if (_reactNative.Platform.OS === 'ios') {
19
+ return Authsignal.launch(url);
20
+ } else {
21
+ return new Promise((resolve, reject) => {
22
+ const callback = (error, token) => {
23
+ if (token) {
24
+ resolve(token);
25
+ } else if (error) {
26
+ if (error.error === 'user_cancelled') {
27
+ resolve(null);
28
+ } else {
29
+ reject(error);
30
+ }
31
+ } else {
32
+ reject('Unexpected error');
33
+ }
34
+ };
35
+ Authsignal.launch(url, callback);
36
+ });
37
+ }
38
+ }
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Authsignal","NativeModules","Proxy","get","Error","launch","url","OS","Promise","resolve","reject","callback","error","token"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA;AAEA,MAAMA,aAAa,GAChB,kFAAiF,GAClFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,UAAU,GAAGC,0BAAa,CAACD,UAAU,GACvCC,0BAAa,CAACD,UAAU,GACxB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEE,SAASU,MAAM,CAACC,GAAW,EAA0B;EAC1D,IAAIV,qBAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOP,UAAU,CAACK,MAAM,CAACC,GAAG,CAAC;EAC/B,CAAC,MAAM;IACL,OAAO,IAAIE,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,MAAMC,QAAQ,GAAG,CAACC,KAAU,EAAEC,KAAa,KAAK;QAC9C,IAAIA,KAAK,EAAE;UACTJ,OAAO,CAACI,KAAK,CAAC;QAChB,CAAC,MAAM,IAAID,KAAK,EAAE;UAChB,IAAIA,KAAK,CAACA,KAAK,KAAK,gBAAgB,EAAE;YACpCH,OAAO,CAAC,IAAI,CAAC;UACf,CAAC,MAAM;YACLC,MAAM,CAACE,KAAK,CAAC;UACf;QACF,CAAC,MAAM;UACLF,MAAM,CAAC,kBAAkB,CAAC;QAC5B;MACF,CAAC;MAEDV,UAAU,CAACK,MAAM,CAACC,GAAG,EAAEK,QAAQ,CAAC;IAClC,CAAC,CAAC;EACJ;AACF"}