react-native-authsignal 1.0.13 → 1.1.3

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.
Files changed (30) hide show
  1. package/android/build.gradle +27 -87
  2. package/android/gradle/wrapper/gradle-wrapper.properties +3 -2
  3. package/android/gradle.properties +4 -3
  4. package/android/src/main/java/com/authsignal/react/AuthenticationActivity.kt +69 -0
  5. package/android/src/main/java/com/authsignal/react/AuthsignalEmailModule.kt +113 -0
  6. package/android/src/main/java/com/authsignal/react/AuthsignalModule.kt +115 -0
  7. package/android/src/main/java/com/authsignal/react/AuthsignalPackage.kt +23 -0
  8. package/android/src/main/java/com/authsignal/react/AuthsignalPasskeyModule.kt +103 -0
  9. package/android/src/main/java/com/authsignal/react/AuthsignalPushModule.kt +152 -0
  10. package/android/src/main/java/com/authsignal/react/AuthsignalSMSModule.kt +117 -0
  11. package/android/src/main/java/com/authsignal/react/AuthsignalTOTPModule.kt +95 -0
  12. package/android/src/main/java/com/authsignal/react/RedirectActivity.kt +17 -0
  13. package/ios/AuthsignalEmailModule.swift +3 -3
  14. package/ios/AuthsignalPasskeyModule.swift +2 -2
  15. package/ios/AuthsignalPushModule.swift +5 -5
  16. package/ios/AuthsignalSMSModule.swift +3 -3
  17. package/ios/AuthsignalTOTPModule.swift +2 -2
  18. package/lib/typescript/types.d.ts +1 -1
  19. package/lib/typescript/types.d.ts.map +1 -1
  20. package/package.json +1 -1
  21. package/src/types.ts +1 -1
  22. package/android/src/main/java/com/authsignal/react/AuthenticationActivity.java +0 -73
  23. package/android/src/main/java/com/authsignal/react/AuthsignalEmailModule.java +0 -139
  24. package/android/src/main/java/com/authsignal/react/AuthsignalModule.java +0 -127
  25. package/android/src/main/java/com/authsignal/react/AuthsignalPackage.java +0 -29
  26. package/android/src/main/java/com/authsignal/react/AuthsignalPasskeyModule.java +0 -133
  27. package/android/src/main/java/com/authsignal/react/AuthsignalPushModule.java +0 -188
  28. package/android/src/main/java/com/authsignal/react/AuthsignalSMSModule.java +0 -139
  29. package/android/src/main/java/com/authsignal/react/AuthsignalTOTPModule.java +0 -116
  30. package/android/src/main/java/com/authsignal/react/RedirectActivity.java +0 -18
@@ -1,139 +0,0 @@
1
- package com.authsignal.react;
2
-
3
- import android.app.Activity;
4
- import android.util.Log;
5
-
6
- import androidx.annotation.NonNull;
7
-
8
- import com.authsignal.sms.AuthsignalSMS;
9
- import com.authsignal.models.*;
10
- import com.facebook.react.bridge.Arguments;
11
- import com.facebook.react.bridge.Promise;
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.util.HashMap;
18
- import java.util.Map;
19
-
20
- public class AuthsignalSMSModule extends ReactContextBaseJavaModule {
21
- private final ReactApplicationContext reactContext;
22
-
23
- private AuthsignalSMS authsignalSMS;
24
-
25
- private final String TAG = "AuthsignalSMSModule";
26
- private final String INIT_WARNING = "AuthsignalSMSModule is not initialized.";
27
-
28
- public AuthsignalSMSModule(ReactApplicationContext reactContext) {
29
- super(reactContext);
30
- this.reactContext = reactContext;
31
- }
32
-
33
- @Override
34
- public Map<String, Object> getConstants() {
35
- final Map<String, Object> constants = new HashMap<>();
36
- constants.put("bundleIdentifier", reactContext.getApplicationInfo().packageName);
37
- return constants;
38
- }
39
-
40
- @NonNull
41
- @Override
42
- public String getName() {
43
- return "AuthsignalSMSModule";
44
- }
45
-
46
- @ReactMethod
47
- public void initialize(String tenantID, String baseURL, Promise promise) {
48
- Activity currentActivity = reactContext.getCurrentActivity();
49
-
50
- if (currentActivity != null) {
51
- authsignalSMS = new AuthsignalSMS(
52
- tenantID,
53
- baseURL
54
- );
55
- }
56
-
57
- promise.resolve(null);
58
- }
59
-
60
- @ReactMethod
61
- public void enroll(String phoneNumber, Promise promise) {
62
- if (authsignalSMS != null) {
63
- authsignalSMS
64
- .enrollAsync(phoneNumber)
65
- .thenAcceptAsync(response -> {
66
- if (response.getError() != null) {
67
- String errorCode = response.getErrorType() != null ?
68
- response.getErrorType() :
69
- "enroll_error";
70
-
71
- promise.reject(errorCode, response.getError());
72
- } else {
73
- EnrollResponse enrollResponse = response.getData();
74
- WritableMap map = Arguments.createMap();
75
- map.putString("userAuthenticatorId", enrollResponse.getUserAuthenticatorId());
76
- promise.resolve(map);
77
- }
78
- });
79
- } else {
80
- Log.w(TAG, INIT_WARNING);
81
-
82
- promise.resolve(null);
83
- }
84
- }
85
-
86
- @ReactMethod
87
- public void challenge(Promise promise) {
88
- if (authsignalSMS != null) {
89
- authsignalSMS
90
- .challengeAsync()
91
- .thenAcceptAsync(response -> {
92
- if (response.getError() != null) {
93
- String errorCode = response.getErrorType() != null ?
94
- response.getErrorType() :
95
- "challenge_error";
96
-
97
- promise.reject(errorCode, response.getError());
98
- } else {
99
- ChallengeResponse challengeResponse = response.getData();
100
- WritableMap map = Arguments.createMap();
101
- map.putString("challengeId", challengeResponse.getChallengeId());
102
- promise.resolve(map);
103
- }
104
- });
105
- } else {
106
- Log.w(TAG, INIT_WARNING);
107
-
108
- promise.resolve(null);
109
- }
110
- }
111
-
112
- @ReactMethod
113
- public void verify(String code, Promise promise) {
114
- if (authsignalSMS != null) {
115
- authsignalSMS
116
- .verifyAsync(code)
117
- .thenAcceptAsync(response -> {
118
- if (response.getError() != null) {
119
- String errorCode = response.getErrorType() != null ?
120
- response.getErrorType() :
121
- "verify_error";
122
-
123
- promise.reject(errorCode, response.getError());
124
- } else {
125
- VerifyResponse verifyResponse = response.getData();
126
- WritableMap map = Arguments.createMap();
127
- map.putBoolean("isVerified", verifyResponse.isVerified());
128
- map.putString("token", verifyResponse.getToken());
129
- map.putString("failureReason", verifyResponse.getFailureReason());
130
- promise.resolve(map);
131
- }
132
- });
133
- } else {
134
- Log.w(TAG, INIT_WARNING);
135
-
136
- promise.resolve(null);
137
- }
138
- }
139
- }
@@ -1,116 +0,0 @@
1
- package com.authsignal.react;
2
-
3
- import android.app.Activity;
4
- import android.util.Log;
5
-
6
- import androidx.annotation.NonNull;
7
-
8
- import com.authsignal.totp.AuthsignalTOTP;
9
- import com.authsignal.models.*;
10
- import com.authsignal.totp.api.models.*;
11
- import com.facebook.react.bridge.Arguments;
12
- import com.facebook.react.bridge.Promise;
13
- import com.facebook.react.bridge.ReactApplicationContext;
14
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
15
- import com.facebook.react.bridge.ReactMethod;
16
- import com.facebook.react.bridge.WritableMap;
17
-
18
- import java.util.HashMap;
19
- import java.util.Map;
20
-
21
- public class AuthsignalTOTPModule extends ReactContextBaseJavaModule {
22
- private final ReactApplicationContext reactContext;
23
-
24
- private AuthsignalTOTP authsignalTOTP;
25
-
26
- private final String TAG = "AuthsignalTOTPModule";
27
- private final String INIT_WARNING = "AuthsignalTOTPModule is not initialized.";
28
-
29
- public AuthsignalTOTPModule(ReactApplicationContext reactContext) {
30
- super(reactContext);
31
- this.reactContext = reactContext;
32
- }
33
-
34
- @Override
35
- public Map<String, Object> getConstants() {
36
- final Map<String, Object> constants = new HashMap<>();
37
- constants.put("bundleIdentifier", reactContext.getApplicationInfo().packageName);
38
- return constants;
39
- }
40
-
41
- @NonNull
42
- @Override
43
- public String getName() {
44
- return "AuthsignalTOTPModule";
45
- }
46
-
47
- @ReactMethod
48
- public void initialize(String tenantID, String baseURL, Promise promise) {
49
- Activity currentActivity = reactContext.getCurrentActivity();
50
-
51
- if (currentActivity != null) {
52
- authsignalTOTP = new AuthsignalTOTP(
53
- tenantID,
54
- baseURL
55
- );
56
- }
57
-
58
- promise.resolve(null);
59
- }
60
-
61
- @ReactMethod
62
- public void enroll(Promise promise) {
63
- if (authsignalTOTP != null) {
64
- authsignalTOTP
65
- .enrollAsync()
66
- .thenAcceptAsync(response -> {
67
- if (response.getError() != null) {
68
- String errorCode = response.getErrorType() != null ?
69
- response.getErrorType() :
70
- "enroll_error";
71
-
72
- promise.reject(errorCode, response.getError());
73
- } else {
74
- EnrollTOTPResponse enrollResponse = response.getData();
75
- WritableMap map = Arguments.createMap();
76
- map.putString("userAuthenticatorId", enrollResponse.getUserAuthenticatorId());
77
- map.putString("uri", enrollResponse.getUri());
78
- map.putString("secret", enrollResponse.getSecret());
79
- promise.resolve(map);
80
- }
81
- });
82
- } else {
83
- Log.w(TAG, INIT_WARNING);
84
-
85
- promise.resolve(null);
86
- }
87
- }
88
-
89
- @ReactMethod
90
- public void verify(String code, Promise promise) {
91
- if (authsignalTOTP != null) {
92
- authsignalTOTP
93
- .verifyAsync(code)
94
- .thenAcceptAsync(response -> {
95
- if (response.getError() != null) {
96
- String errorCode = response.getErrorType() != null ?
97
- response.getErrorType() :
98
- "verify_error";
99
-
100
- promise.reject(errorCode, response.getError());
101
- } else {
102
- VerifyResponse verifyResponse = response.getData();
103
- WritableMap map = Arguments.createMap();
104
- map.putBoolean("isVerified", verifyResponse.isVerified());
105
- map.putString("token", verifyResponse.getToken());
106
- map.putString("failureReason", verifyResponse.getFailureReason());
107
- promise.resolve(map);
108
- }
109
- });
110
- } else {
111
- Log.w(TAG, INIT_WARNING);
112
-
113
- promise.resolve(null);
114
- }
115
- }
116
- }
@@ -1,18 +0,0 @@
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
- }