Skip to content

Commit 13642e0

Browse files
committed
fetch and merge upstream master branch
2 parents f96ba7e + 4183512 commit 13642e0

File tree

14 files changed

+492
-37
lines changed

14 files changed

+492
-37
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
release:
1010
name: Release
11-
runs-on: ubuntu-18.04
11+
runs-on: ubuntu-22.04
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v1

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
build:
1010
name: CI
11-
runs-on: ubuntu-18.04
11+
runs-on: ubuntu-22.04
1212
steps:
1313
- uses: actions/checkout@v1
1414
- name: CI

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# [6.2.0](https://github.com/Rapsssito/react-native-tcp-socket/compare/v6.1.0...v6.2.0) (2024-07-08)
2+
3+
4+
### Features
5+
6+
* **Android:** Add TLS key & cert for server ([#192](https://github.com/Rapsssito/react-native-tcp-socket/issues/192)) ([054c789](https://github.com/Rapsssito/react-native-tcp-socket/commit/054c7890dc0575acceb93c24794c0fade6c548a8))
7+
8+
# [6.1.0](https://github.com/Rapsssito/react-native-tcp-socket/compare/v6.0.6...v6.1.0) (2024-06-20)
9+
10+
11+
### Features
12+
13+
* **Android:** Add support for Android concurrent connections (multiple networks) ([#193](https://github.com/Rapsssito/react-native-tcp-socket/issues/193)) ([a2d1a79](https://github.com/Rapsssito/react-native-tcp-socket/commit/a2d1a794421dbd44d1ada9c05c51fffc0085a67f))
14+
115
## [6.0.6](https://github.com/Rapsssito/react-native-tcp-socket/compare/v6.0.5...v6.0.6) (2023-02-08)
216

317

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ React Native TCP socket API for Android, iOS & macOS with **SSL/TLS support**. I
1212
- [Getting started](#getting-started)
1313
- [Overriding `net`](#overriding-net)
1414
- [Overriding `tls`](#overriding-tls)
15-
- [Using React Native >= 0.60](#using-react-native--060)
16-
- [Self-Signed SSL (only available for React Native > 0.60)](#self-signed-ssl-only-available-for-react-native--060)
17-
- [Using React Native < 0.60](#using-react-native--060-1)
15+
- [Using React Native \>= 0.60](#using-react-native--060)
16+
- [Self-Signed SSL (only available for React Native \> 0.60)](#self-signed-ssl-only-available-for-react-native--060)
17+
- [Using React Native \< 0.60](#using-react-native--060-1)
1818
- [React Native Compatibility](#react-native-compatibility)
1919
- [Usage](#usage)
2020
- [Client example](#client-example)
@@ -409,6 +409,8 @@ Here are listed all methods implemented in `react-native-tcp-socket` that imitat
409409
#### TLSSocket
410410
* **Methods:**
411411
* All methods from [`Socket`](#socket)
412+
* [`getCertificate()`](https://nodejs.org/api/tls.html#tlssocketgetcertificate) _Android only_
413+
* **[`getPeerCertificate()`](https://nodejs.org/api/tls.html#tlssocketgetpeercertificatedetailed)** _Android only_
412414
* **Properties:**
413415
* All properties from [`Socket`](#socket)
414416
* **Events:**
@@ -418,10 +420,15 @@ Here are listed all methods implemented in `react-native-tcp-socket` that imitat
418420
##### `tls.connectTLS()` <!-- omit in toc -->
419421
`tls.connectTLS(options[, callback])` creates a TLS socket connection using the given `options`. The `options` parameter must be an `object` with the following properties:
420422

421-
| Property | Type | iOS/macOS | Android | Description |
422-
| -------- | ---------- | :-------: | :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
423-
| `ca` | `<import>` ||| CA file (.pem format) to trust. If `null`, it will use the device's default SSL trusted list. Useful for self-signed certificates. _Check the [documentation](#self-signed-ssl-only-available-for-react-native--060) for generating such file_. **Default**: `null`. |
424-
| `...` | `<any>` ||| Any other [`socket.connect()`](#netcreateconnection----omit-in-toc) options not already listed. |
423+
| Property | Type | iOS/macOS | Android | Description |
424+
| ----------------- | ---------- | :-------: | :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
425+
| `ca` | `<import>` ||| CA file (.pem format) to trust. If `null`, it will use the device's default SSL trusted list. Useful for self-signed certificates. _Check the [documentation](#self-signed-ssl-only-available-for-react-native--060) for generating such file_. **Default**: `null`. |
426+
| `key` | `<import>` ||| Private key file (.pem format). _Check the [documentation](#self-signed-ssl-only-available-for-react-native--060) for generating such file_. |
427+
| `cert` | `<import>` ||| Public certificate file (.pem format). _Check the [documentation](#self-signed-ssl-only-available-for-react-native--060) for generating such file_. |
428+
| `androidKeyStore` | `<string>` ||| Android KeyStore alias. |
429+
| `certAlias` | `<string>` ||| Android KeyStore certificate alias. |
430+
| `keyAlias` | `<string>` ||| Android KeyStore private key alias. |
431+
| `...` | `<any>` ||| Any other [`socket.connect()`](#netcreateconnection----omit-in-toc) options not already listed. |
425432

426433
#### TLSServer
427434
__Note__: The TLS server is named `Server` in Node's tls, but it is named `TLSServer` in `react-native-tcp-socket` in order to avoid confusion with the [`Server`](#server) class.

android/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ android {
1616
dependencies {
1717
//noinspection GradleDynamicVersion
1818
implementation 'com.facebook.react:react-native:+' // From node_modules
19+
// Bouncy Castle dependencies
20+
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
21+
implementation 'org.bouncycastle:bcpkix-jdk15on:1.70'
1922
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.asterinet.react.tcpsocket;
2+
3+
public class KeystoreInfo {
4+
private String keystoreName;
5+
private String caAlias;
6+
private String certAlias;
7+
private String keyAlias;
8+
9+
public KeystoreInfo(String keystoreName, String caAlias, String certAlias, String keyAlias) {
10+
this.keystoreName = keystoreName;
11+
this.caAlias = (caAlias == null || caAlias.isEmpty()) ? "ca" : caAlias;
12+
this.certAlias = (certAlias == null || certAlias.isEmpty()) ? "cert" : certAlias;
13+
this.keyAlias = (keyAlias == null || keyAlias.isEmpty()) ? "key" : keyAlias;
14+
}
15+
16+
public String getKeystoreName() {
17+
return this.keystoreName;
18+
}
19+
20+
public void setKeystoreName(String keystoreName) {
21+
this.keystoreName = keystoreName;
22+
}
23+
24+
public String getCaAlias() {
25+
return this.caAlias;
26+
}
27+
28+
public void setCaAlias(String caAlias) {
29+
this.caAlias = caAlias;
30+
}
31+
32+
public String getCertAlias() {
33+
return this.certAlias;
34+
}
35+
36+
public void setCertAlias(String certAlias) {
37+
this.certAlias = certAlias;
38+
}
39+
40+
public String getKeyAlias() {
41+
return this.keyAlias;
42+
}
43+
44+
public void setKeyAlias(String keyAlias) {
45+
this.keyAlias = keyAlias;
46+
}
47+
48+
@Override
49+
public String toString() {
50+
return "KeystoreInfo{" +
51+
"keystoreName='" + this.keystoreName + '\'' +
52+
", caAlias='" + this.caAlias + '\'' +
53+
", certAlias='" + this.certAlias + '\'' +
54+
", keyAlias='" + this.keyAlias + '\'' +
55+
'}';
56+
}
57+
}
58+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.asterinet.react.tcpsocket;
2+
3+
public class ResolvableOption {
4+
private final String value;
5+
private final boolean needsResolution;
6+
7+
public ResolvableOption(String value, boolean needsResolution) {
8+
this.value = value;
9+
this.needsResolution = needsResolution;
10+
}
11+
12+
public String getValue() {
13+
return value;
14+
}
15+
16+
public boolean needsResolution() {
17+
return needsResolution;
18+
}
19+
}
20+

0 commit comments

Comments
 (0)