diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-06-15 22:08:28 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-06-15 22:08:28 -0500 |
commit | a56cae626abf6c553cd9756db875c8ab5f903879 (patch) | |
tree | 4c2c8ef9f00006a573959db84c8e3b037105a0bd /ios | |
parent | 2c73703d7d59bdd9a3e4b10c41e5099b8f92db1c (diff) | |
download | voidsky-a56cae626abf6c553cd9756db875c8ab5f903879.tar.zst |
Move the secure-random code into this project due to build issues with the module, which is no longer maintained
Diffstat (limited to 'ios')
-rw-r--r-- | ios/AppSecureRandomModule.h | 5 | ||||
-rw-r--r-- | ios/AppSecureRandomModule.m | 27 | ||||
-rw-r--r-- | ios/Podfile.lock | 6 | ||||
-rw-r--r-- | ios/app.xcodeproj/project.pbxproj | 8 | ||||
-rw-r--r-- | ios/app/AppDelegate.mm | 2 |
5 files changed, 41 insertions, 7 deletions
diff --git a/ios/AppSecureRandomModule.h b/ios/AppSecureRandomModule.h new file mode 100644 index 000000000..0431684c3 --- /dev/null +++ b/ios/AppSecureRandomModule.h @@ -0,0 +1,5 @@ +#import <React/RCTBridgeModule.h> + +@interface AppSecureRandomModule : NSObject <RCTBridgeModule> + +@end diff --git a/ios/AppSecureRandomModule.m b/ios/AppSecureRandomModule.m new file mode 100644 index 000000000..9aba127fc --- /dev/null +++ b/ios/AppSecureRandomModule.m @@ -0,0 +1,27 @@ +#import "AppSecureRandomModule.h" + +@implementation AppSecureRandomModule + +RCT_EXPORT_MODULE(); + ++ (BOOL)requiresMainQueueSetup +{ + return NO; +} + +RCT_REMAP_METHOD(generateSecureRandomAsBase64, + withLength:(int)length + resolver:(RCTPromiseResolveBlock)resolve + rejecter:(RCTPromiseRejectBlock)reject) +{ + NSMutableData* bytes = [NSMutableData dataWithLength:length]; + int result = SecRandomCopyBytes(kSecRandomDefault,length, [bytes mutableBytes]); + if (result == errSecSuccess) { + resolve([bytes base64EncodedStringWithOptions:0]); + } else { + NSError *error = [NSError errorWithDomain:@"RNSecureRandom" code:result userInfo: nil]; + reject(@"randombytes_error", @"Error generating random bytes", error); + } +} + +@end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 63cc844f3..8be1857f2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -296,8 +296,6 @@ PODS: - RNScreens (3.13.1): - React-Core - React-RCTImage - - RNSecureRandom (1.0.0): - - React - Yoga (1.14.0) DEPENDENCIES: @@ -337,7 +335,6 @@ DEPENDENCIES: - "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)" - RNInAppBrowser (from `../node_modules/react-native-inappbrowser-reborn`) - RNScreens (from `../node_modules/react-native-screens`) - - RNSecureRandom (from `../node_modules/react-native-securerandom`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) SPEC REPOS: @@ -413,8 +410,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-inappbrowser-reborn" RNScreens: :path: "../node_modules/react-native-screens" - RNSecureRandom: - :path: "../node_modules/react-native-securerandom" Yoga: :path: "../node_modules/react-native/ReactCommon/yoga" @@ -454,7 +449,6 @@ SPEC CHECKSUMS: RNCAsyncStorage: 466b9df1a14bccda91da86e0b7d9a345d78e1673 RNInAppBrowser: 3ff3a3b8f458aaf25aaee879d057352862edf357 RNScreens: 40a2cb40a02a609938137a1e0acfbf8fc9eebf19 - RNSecureRandom: 0dcee021fdb3d50cd5cee5db0ebf583c42f5af0e Yoga: 99652481fcd320aefa4a7ef90095b95acd181952 PODFILE CHECKSUM: cf94853ebcb0d8e0d027dca9ab7a4ede886a8f20 diff --git a/ios/app.xcodeproj/project.pbxproj b/ios/app.xcodeproj/project.pbxproj index b23ff989a..06ea7c618 100644 --- a/ios/app.xcodeproj/project.pbxproj +++ b/ios/app.xcodeproj/project.pbxproj @@ -13,6 +13,8 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 5CEAE7B7A55582F96F1D5952 /* libPods-app.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FCB672808307A6013805A3FE /* libPods-app.a */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; + E4BD704B285AD57E00A8FED9 /* AppSecureRandomModule.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BD704A285AD57E00A8FED9 /* AppSecureRandomModule.m */; }; + E4BD704C285AD57E00A8FED9 /* AppSecureRandomModule.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BD704A285AD57E00A8FED9 /* AppSecureRandomModule.m */; }; FEB90D21557517F9279AECA4 /* libPods-app-appTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BAD3BC60FA05CF2D4F6F9BA2 /* libPods-app-appTests.a */; }; /* End PBXBuildFile section */ @@ -42,6 +44,8 @@ 970005155A83960D1D13380F /* Pods-app.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-app.release.xcconfig"; path = "Target Support Files/Pods-app/Pods-app.release.xcconfig"; sourceTree = "<group>"; }; BAD3BC60FA05CF2D4F6F9BA2 /* libPods-app-appTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-app-appTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; E4437C9E28581FA7006DA9E7 /* app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = app.entitlements; path = app/app.entitlements; sourceTree = "<group>"; }; + E4BD7049285AD54000A8FED9 /* AppSecureRandomModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppSecureRandomModule.h; sourceTree = "<group>"; }; + E4BD704A285AD57E00A8FED9 /* AppSecureRandomModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppSecureRandomModule.m; sourceTree = "<group>"; }; ED22CAA45207BC18E75DB44B /* Pods-app.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-app.debug.xcconfig"; path = "Target Support Files/Pods-app/Pods-app.debug.xcconfig"; sourceTree = "<group>"; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; FCB672808307A6013805A3FE /* libPods-app.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-app.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -94,6 +98,8 @@ 13B07FB61A68108700A75B9A /* Info.plist */, 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 13B07FB71A68108700A75B9A /* main.m */, + E4BD7049285AD54000A8FED9 /* AppSecureRandomModule.h */, + E4BD704A285AD57E00A8FED9 /* AppSecureRandomModule.m */, ); name = app; sourceTree = "<group>"; @@ -369,6 +375,7 @@ buildActionMask = 2147483647; files = ( 00E356F31AD99517003FC87E /* appTests.m in Sources */, + E4BD704C285AD57E00A8FED9 /* AppSecureRandomModule.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -377,6 +384,7 @@ buildActionMask = 2147483647; files = ( 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */, + E4BD704B285AD57E00A8FED9 /* AppSecureRandomModule.m in Sources */, 13B07FC11A68108700A75B9A /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ios/app/AppDelegate.mm b/ios/app/AppDelegate.mm index 8b143fee2..474f994e8 100644 --- a/ios/app/AppDelegate.mm +++ b/ios/app/AppDelegate.mm @@ -44,7 +44,7 @@ bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; #endif - UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"app", nil); + UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"xyz.blueskyweb.pubsq", nil); if (@available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; |