-
Notifications
You must be signed in to change notification settings - Fork 141
SSL Pinning with FSNetwork
Flagship 10 adds support for SSL pinning functionality to FSNetwork.
When pinning is enabled for a request, FSNetwork will use native networking stacks (OKHTTP 3 for Android and AFNetworking on iOS) as Axios is a fully JavaScript implementation and thus doesn't support the functionality. FSNetwork will continue to use Axios when pinning is not explicitly enabled.
Available methods: GET, POST, PUT, DELETE
NOTE: Methods PATCH and HEAD are not available with SSL Pinning feature.
To generate ssl certificates for the resource:
- Get certificates for the domain:
$ openssl s_client -showcerts -connect your.domain.name:443
- Save certificates:
$ nano certificate.pem
- Convert it to .cer with this command:
$ openssl x509 -in certificate.pem -outform der -out certificate.cer
-
Move generated .cer certificates to the project folder. (e.g. /youproject/assets/ssl)
-
Register certificates in env file configuration
{
...envConfig,
"pinnedCerts": [
{
"baseUrl": "https://your.domain.name",
"path": "assets/ssl/certificate.cer"
}
]
}
- Initialize project. The CLI tools will automatically add certificates from env to the iOS and Android directories.
To use SSL Pinning with FSNetwork add the pinnedCertificate property to the FSNetworkConfiguration configuration.
// from env
import { env } from '@brandingbrand/app';
const dataSource = new FSNetwork({
...configuration,
pinnedCertificates: env.pinnedCerts
});
// manually
const dataSource = new FSNetwork({
...configuration,
pinnedCertificates: [
{
"baseUrl": "https://your.domain.name",
"path": "assets/ssl/certificate.cer"
}
]
});
The ssl pinning will be applied only for sources that mentioned in pinnedCertificate object. Otherwise, FSNetwork will use axios.
Getting Started
- Flagship Technical Introduction
- Setting up Your Development Environment
- Getting Started with Flagship
- Creating a Flagship App
How To
- Running Flagship Apps
- Managing Environments
- Creating App Icons
- Creating Launch Screens
- Signing Your Apps
- Using React Native Permissions v2
- Using SSL Certificate Pinning
- Initializing Multiple Xcode Targets
Major Releases