Merge branch 'develop' into chore/migration-ts-redux-connect-v2

This commit is contained in:
Diego Mello 2022-01-13 11:16:21 -03:00 committed by GitHub
commit 0cdf516bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 26 deletions

View File

@ -11,9 +11,12 @@ import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.Promise;
import java.net.Socket; import java.net.Socket;
import java.security.KeyStore;
import java.security.Principal; import java.security.Principal;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509ExtendedKeyManager; import javax.net.ssl.X509ExtendedKeyManager;
import java.security.PrivateKey; import java.security.PrivateKey;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
@ -21,11 +24,12 @@ import javax.net.ssl.X509TrustManager;
import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import java.lang.InterruptedException;
import android.app.Activity; import android.app.Activity;
import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManager;
import android.security.KeyChain; import android.security.KeyChain;
import android.security.KeyChainAliasCallback; import android.security.KeyChainAliasCallback;
import java.util.Arrays;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.RNFetchBlob.RNFetchBlob; import com.RNFetchBlob.RNFetchBlob;
@ -52,8 +56,9 @@ public class SSLPinningModule extends ReactContextBaseJavaModule implements KeyC
public void apply(OkHttpClient.Builder builder) { public void apply(OkHttpClient.Builder builder) {
if (alias != null) { if (alias != null) {
SSLSocketFactory sslSocketFactory = getSSLFactory(alias); SSLSocketFactory sslSocketFactory = getSSLFactory(alias);
X509TrustManager trustManager = getTrustManagerFactory();
if (sslSocketFactory != null) { if (sslSocketFactory != null) {
builder.sslSocketFactory(sslSocketFactory); builder.sslSocketFactory(sslSocketFactory, trustManager);
} }
} }
} }
@ -68,8 +73,9 @@ public class SSLPinningModule extends ReactContextBaseJavaModule implements KeyC
if (alias != null) { if (alias != null) {
SSLSocketFactory sslSocketFactory = getSSLFactory(alias); SSLSocketFactory sslSocketFactory = getSSLFactory(alias);
X509TrustManager trustManager = getTrustManagerFactory();
if (sslSocketFactory != null) { if (sslSocketFactory != null) {
builder.sslSocketFactory(sslSocketFactory); builder.sslSocketFactory(sslSocketFactory, trustManager);
} }
} }
@ -162,25 +168,9 @@ public class SSLPinningModule extends ReactContextBaseJavaModule implements KeyC
} }
}; };
final TrustManager[] trustAllCerts = new TrustManager[] { final X509TrustManager trustManager = getTrustManagerFactory();
new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return certChain;
}
}
};
final SSLContext sslContext = SSLContext.getInstance("TLS"); final SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(new KeyManager[]{keyManager}, trustAllCerts, new java.security.SecureRandom()); sslContext.init(new KeyManager[]{keyManager}, new TrustManager[]{trustManager}, new java.security.SecureRandom());
SSLContext.setDefault(sslContext); SSLContext.setDefault(sslContext);
final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
@ -190,4 +180,19 @@ public class SSLPinningModule extends ReactContextBaseJavaModule implements KeyC
return null; return null;
} }
} }
public static X509TrustManager getTrustManagerFactory() {
try {
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init((KeyStore) null);
TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers));
}
final X509TrustManager trustManager = (X509TrustManager) trustManagers[0];
return trustManager;
} catch (Exception e) {
return null;
}
}
} }

View File

@ -514,7 +514,7 @@ PODS:
- React-Core - React-Core
- RNDateTimePicker (3.5.2): - RNDateTimePicker (3.5.2):
- React-Core - React-Core
- RNDeviceInfo (8.1.3): - RNDeviceInfo (8.4.8):
- React-Core - React-Core
- RNFastImage (8.2.0): - RNFastImage (8.2.0):
- React - React
@ -950,7 +950,7 @@ SPEC CHECKSUMS:
EXVideoThumbnails: 442c3abadb51a81551a3b53705b7560de390e6f7 EXVideoThumbnails: 442c3abadb51a81551a3b53705b7560de390e6f7
EXWebBrowser: 76783ba5dcb8699237746ecf41a9643d428a4cc5 EXWebBrowser: 76783ba5dcb8699237746ecf41a9643d428a4cc5
FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b
FBReactNativeSpec: 686ac17e193dcf7d5df4d772b224504dd2f3ad81 FBReactNativeSpec: 8a1012a62d7a3d667376b413656d780b8e4680ce
Firebase: 919186c8e119dd9372a45fd1dd17a8a942bc1892 Firebase: 919186c8e119dd9372a45fd1dd17a8a942bc1892
FirebaseAnalytics: 5fa308e1b13f838d0f6dc74719ac2a72e8c5afc4 FirebaseAnalytics: 5fa308e1b13f838d0f6dc74719ac2a72e8c5afc4
FirebaseCore: 8cd4f8ea22075e0ee582849b1cf79d8816506085 FirebaseCore: 8cd4f8ea22075e0ee582849b1cf79d8816506085
@ -1028,7 +1028,7 @@ SPEC CHECKSUMS:
RNConfigReader: 396da6a6444182a76e8ae0930b9436c7575045cb RNConfigReader: 396da6a6444182a76e8ae0930b9436c7575045cb
RNCPicker: 914b557e20b3b8317b084aca9ff4b4edb95f61e4 RNCPicker: 914b557e20b3b8317b084aca9ff4b4edb95f61e4
RNDateTimePicker: 7658208086d86d09e1627b5c34ba0cf237c60140 RNDateTimePicker: 7658208086d86d09e1627b5c34ba0cf237c60140
RNDeviceInfo: 8d3a29207835f972bce883723882980143270d55 RNDeviceInfo: 0400a6d0c94186d1120c3cbd97b23abc022187a9
RNFastImage: f40d202ea2367239f71bc7cf11315f4bebab85b4 RNFastImage: f40d202ea2367239f71bc7cf11315f4bebab85b4
RNFBAnalytics: dae6d7b280ba61c96e1bbdd34aca3154388f025e RNFBAnalytics: dae6d7b280ba61c96e1bbdd34aca3154388f025e
RNFBApp: 6fd8a7e757135d4168bf033a8812c241af7363a0 RNFBApp: 6fd8a7e757135d4168bf033a8812c241af7363a0
@ -1055,4 +1055,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 9fd323641c96f6bf98b309066332c3ff95b9cf15 PODFILE CHECKSUM: 9fd323641c96f6bf98b309066332c3ff95b9cf15
COCOAPODS: 1.10.1 COCOAPODS: 1.11.2

View File

@ -1,5 +1,5 @@
diff --git a/node_modules/react-native-device-info/android/build.gradle b/node_modules/react-native-device-info/android/build.gradle diff --git a/node_modules/react-native-device-info/android/build.gradle b/node_modules/react-native-device-info/android/build.gradle
index 952667b..03cf7fd 100644 index de22598..eafedfe 100644
--- a/node_modules/react-native-device-info/android/build.gradle --- a/node_modules/react-native-device-info/android/build.gradle
+++ b/node_modules/react-native-device-info/android/build.gradle +++ b/node_modules/react-native-device-info/android/build.gradle
@@ -51,16 +51,19 @@ repositories { @@ -51,16 +51,19 @@ repositories {