Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
node-version: 10.0.0
- name: Publish if version has been updated
uses: pascalgn/[email protected].4
uses: pascalgn/[email protected].9
with: # All of theses inputs are optional
tag_name: "v%s"
tag_message: "v%s"
Expand All @@ -26,3 +26,4 @@ jobs:
env: # More info about the environment variables in the README
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings

8 changes: 3 additions & 5 deletions ios/RNSslPinning.podspec → RNSslPinning.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'json'

package = JSON.parse(File.read(File.join(__dir__, '../package.json')))
package = JSON.parse(File.read(File.join(__dir__, './package.json')))

Pod::Spec.new do |s|
s.name = "RNSslPinning"
Expand All @@ -10,16 +10,14 @@ Pod::Spec.new do |s|
s.homepage = package['homepage']
s.license = package['license']
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
s.author = { "author" => "[email protected]" }
s.author = { "author" => "[email protected]" }
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/MaxToyberman/react-native-ssl-pinning", :tag => "master" }
s.source_files = "RNSslPinning/**/*.{h,m}"
s.source_files = "ios/RNSslPinning/**/*.{h,m}"
s.requires_arc = true


s.dependency "React"
s.dependency "AFNetworking", "~> 4.0"

end


6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ repositories {

dependencies {
implementation "com.facebook.react:react-native:+"
implementation "com.squareup.okhttp3:okhttp:4.2.2"
implementation "com.squareup.okhttp3:okhttp:4.9.0"
implementation "com.squareup.okio:okio:2.6.0"
implementation "com.github.franmontiel:PersistentCookieJar:v1.0.1"
implementation "com.squareup.okhttp3:logging-interceptor:4.2.2"
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.2.2"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.0"
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.0"
}

9 changes: 9 additions & 0 deletions ios/RNSslPinning/RNSslPinning.m
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ -(void) performMultipartRequest: (AFURLSessionManager*)manager obj:(NSDictionary
AFSecurityPolicy *policy;
BOOL pkPinning = [[obj objectForKey:@"pkPinning"] boolValue];
BOOL disableAllSecurity = [[obj objectForKey:@"disableAllSecurity"] boolValue];
NSString *certBase64=[obj objectForKey:@"cert"];

NSSet *certificates = [AFSecurityPolicy certificatesInBundle:[NSBundle mainBundle]];

Expand All @@ -227,6 +228,14 @@ -(void) performMultipartRequest: (AFURLSessionManager*)manager obj:(NSDictionary
else if (pkPinning){
policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey withPinnedCertificates:certificates];
}
else if (certBase64) {
NSURL *certData = [NSURL URLWithString: [NSString stringWithFormat:@"data:application/octet-stream;base64,%@", certBase64]];
NSData *certRaw = [NSData dataWithContentsOfURL:certData];
policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate
withPinnedCertificates:[NSSet setWithObject:certRaw]];
policy.validatesDomainName = false;
policy.allowInvalidCertificates = true;
}
else{
policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate withPinnedCertificates:certificates];
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-ssl-pinning",
"version": "1.5.4",
"version": "1.5.7",
"description": "React-Native Ssl pinning using OkHttp 3 in Android, and AFNetworking on iOS.",
"main": "index.js",
"scripts": {
Expand All @@ -17,7 +17,7 @@
"license": "MIT",
"homepage": "https://github.com/MaxToyberman/react-native-ssl-pinning#README",
"peerDependencies": {
"react-native": "^0.41.2"
"react-native": "*"
},
"repository": {
"type": "git",
Expand Down