diff --git a/ios/Rsa.xcframework/Info.plist b/ios/Rsa.xcframework/Info.plist new file mode 100644 index 0000000..06447ea --- /dev/null +++ b/ios/Rsa.xcframework/Info.plist @@ -0,0 +1,48 @@ + + + + + AvailableLibraries + + + BinaryPath + librsa_bridge.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + librsa_bridge.a + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + BinaryPath + librsa_bridge.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64 + LibraryPath + librsa_bridge.a + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/ios/Rsa.xcframework/ios-arm64/Headers/librsa_bridge.h b/ios/Rsa.xcframework/ios-arm64/Headers/librsa_bridge.h new file mode 100644 index 0000000..ff18cc0 --- /dev/null +++ b/ios/Rsa.xcframework/ios-arm64/Headers/librsa_bridge.h @@ -0,0 +1,87 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package command-line-arguments */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 3 "main.go" +#include +#include +typedef struct { void* message; int size; char* error; } BytesReturn; + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern BytesReturn* RSABridgeCall(char* name, void* payload, int payloadSize); + +#ifdef __cplusplus +} +#endif diff --git a/ios/Rsa.xcframework/ios-arm64/librsa_bridge.a b/ios/Rsa.xcframework/ios-arm64/librsa_bridge.a new file mode 100644 index 0000000..369f9ac Binary files /dev/null and b/ios/Rsa.xcframework/ios-arm64/librsa_bridge.a differ diff --git a/ios/Rsa.xcframework/ios-arm64_x86_64-simulator/Headers/librsa_bridge.h b/ios/Rsa.xcframework/ios-arm64_x86_64-simulator/Headers/librsa_bridge.h new file mode 100644 index 0000000..ff18cc0 --- /dev/null +++ b/ios/Rsa.xcframework/ios-arm64_x86_64-simulator/Headers/librsa_bridge.h @@ -0,0 +1,87 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package command-line-arguments */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 3 "main.go" +#include +#include +typedef struct { void* message; int size; char* error; } BytesReturn; + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern BytesReturn* RSABridgeCall(char* name, void* payload, int payloadSize); + +#ifdef __cplusplus +} +#endif diff --git a/ios/librsa_bridge.a b/ios/Rsa.xcframework/ios-arm64_x86_64-simulator/librsa_bridge.a similarity index 56% rename from ios/librsa_bridge.a rename to ios/Rsa.xcframework/ios-arm64_x86_64-simulator/librsa_bridge.a index a77bf34..809f6ab 100644 Binary files a/ios/librsa_bridge.a and b/ios/Rsa.xcframework/ios-arm64_x86_64-simulator/librsa_bridge.a differ diff --git a/package.json b/package.json index bd671b9..3ac04c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-fast-rsa", - "version": "2.4.2", + "version": "2.4.3", "description": "library for use RSA", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/react-native-fast-rsa.podspec b/react-native-fast-rsa.podspec index dc49b41..f3ece08 100644 --- a/react-native-fast-rsa.podspec +++ b/react-native-fast-rsa.podspec @@ -2,7 +2,6 @@ require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' -shared_lib = File.join(__dir__, "ios/librsa_bridge.a").gsub(/ /, '\ ') Pod::Spec.new do |s| s.name = package["name"] @@ -16,10 +15,8 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/jerson/react-native-fast-rsa.git", :tag => "#{s.version}" } s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}" - s.vendored_libraries = '*.a' - s.xcconfig = { 'OTHER_LDFLAGS' => "-force_load '#{shared_lib}'"} - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } - s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } + s.vendored_framework = 'ios/Rsa.xcframework' + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0. # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79. diff --git a/scripts/upgrade_bridge_libs.sh b/scripts/upgrade_bridge_libs.sh index 95b430f..37715b2 100755 --- a/scripts/upgrade_bridge_libs.sh +++ b/scripts/upgrade_bridge_libs.sh @@ -9,7 +9,7 @@ REPO="jerson/rsa-mobile" NAME="librsa_bridge" -PLATFORMS=("android" "ios" ) +PLATFORMS=("android" "ios_xcframework" ) OUTPUT_DIRS=("android/src/main" "ios") OUTPUT_SUB_DIRS=("" "") OUTPUT_STRIP_DIRS=(1 1) @@ -42,12 +42,12 @@ do OUTPUT_STRIP_DIR=${OUTPUT_STRIP_DIRS[$INDEX]} FILE_NAME="${NAME}_${PLATFORM}_${VERSION}.tar.gz" - TMP_FILE="$TMP_DIR/$FILE_NAME" + TMP_FILE="$TMP_DIR/$FILE_NAME" FILE_URL="https://github.com/${REPO}/releases/download/${VERSION}/${FILE_NAME}" echo "Platform: $PLATFORM" echo "Downloading: $FILE_URL to $TMP_FILE" - curl -L -o $TMP_FILE "$FILE_URL" + curl -L -o $TMP_FILE "$FILE_URL" echo "Extracting: $TMP_FILE to $OUTPUT_DIR" mkdir -p $OUTPUT_DIR @@ -60,4 +60,3 @@ do done # echo "All updated" -rm ios/librsa_bridge.h || echo "."