RNRandomBytes

This commit is contained in:
Evan
2020-05-04 19:36:39 -04:00
parent b0b2b0b7fb
commit cd4dcf281f
6 changed files with 64 additions and 11 deletions
+1
View File
@@ -201,6 +201,7 @@ android {
}
dependencies {
implementation project(':react-native-randombytes')
implementation project(':react-native-secure-key-store')
implementation project(':realm')
implementation project(':react-native-linear-gradient')
+2
View File
@@ -1,4 +1,6 @@
rootProject.name = 'zeus'
include ':react-native-randombytes'
project(':react-native-randombytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-randombytes/android')
include ':react-native-secure-key-store'
project(':react-native-secure-key-store').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-secure-key-store/android')
include ':realm'
+3 -1
View File
@@ -41,7 +41,9 @@ target 'zeus' do
pod 'RealmJS', :path => '../node_modules/realm'
pod 'react-native-camera-kit', :path => '../node_modules/react-native-camera-kit'
pod 'RNSecureKeyStore', :path => '../node_modules/react-native-secure-key-store'
pod 'react-native-randombytes', :path => '../node_modules/react-native-randombytes'
# pod 'RNSecureKeyStore', :path => '../node_modules/react-native-secure-key-store'
target 'zeusTests' do
inherit! :search_paths
+7 -1
View File
@@ -199,6 +199,8 @@ PODS:
- React-jsinspector (0.61.5)
- react-native-camera-kit (8.0.4):
- React
- react-native-randombytes (3.5.3):
- React
- react-native-safe-area-context (0.6.2):
- React
- React-RCTActionSheet (0.61.5):
@@ -296,6 +298,7 @@ DEPENDENCIES:
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-camera-kit (from `../node_modules/react-native-camera-kit`)
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
@@ -383,6 +386,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-camera-kit:
:path: "../node_modules/react-native-camera-kit"
react-native-randombytes:
:path: "../node_modules/react-native-randombytes"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
React-RCTActionSheet:
@@ -485,6 +490,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
react-native-camera-kit: ded127598a48890a360fbf5e26cf7c44fcc5b873
react-native-randombytes: 991545e6eaaf700b4ee384c291ef3d572e0b2ca8
react-native-safe-area-context: a1d322930b8c5d04ebeb77cc47cc97575ad27203
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
@@ -520,6 +526,6 @@ SPEC CHECKSUMS:
UMTaskManagerInterface: ee5b1ee1056eb338ff2d521ba79460d8cd0bae7d
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
PODFILE CHECKSUM: 7aa39e469b07e6d51082322e7acf71fb31ee6386
PODFILE CHECKSUM: 3bb05fe5a4efc5196776bcc7a16119665faec6d2
COCOAPODS: 1.8.4
+43
View File
@@ -180,6 +180,20 @@
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
9700508B2460D71600AA6E33 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 970050862460D71500AA6E33 /* RNRandomBytes.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 73EEC9391BFE4B1D00D468EB;
remoteInfo = RNRandomBytes;
};
9700508D2460D71600AA6E33 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 970050862460D71500AA6E33 /* RNRandomBytes.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 163CDE4E2087CAD3001065FB;
remoteInfo = "RNRandomBytes-tvOS";
};
971EAC8C23DCF75600DB5FB3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 971EAC8723DCF75600DB5FB3 /* RNSecureKeyStore.xcodeproj */;
@@ -243,6 +257,7 @@
7FE4DFA6CD064723B106677B /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
8838663EE1D7ACC9F9C59F45 /* Pods-zeusTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-zeusTests.release.xcconfig"; path = "Target Support Files/Pods-zeusTests/Pods-zeusTests.release.xcconfig"; sourceTree = "<group>"; };
970050862460D71500AA6E33 /* RNRandomBytes.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNRandomBytes.xcodeproj; path = "../node_modules/react-native-randombytes/RNRandomBytes.xcodeproj"; sourceTree = "<group>"; };
971EAC8723DCF75600DB5FB3 /* RNSecureKeyStore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNSecureKeyStore.xcodeproj; path = "../node_modules/react-native-secure-key-store/ios/RNSecureKeyStore.xcodeproj"; sourceTree = "<group>"; };
97F6D3D82204F5280030F13B /* zeus.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = zeus.jpg; path = zeus/zeus.jpg; sourceTree = "<group>"; };
97F6D46922054E640030F13B /* Octicons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Octicons.ttf; sourceTree = "<group>"; };
@@ -446,6 +461,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
970050862460D71500AA6E33 /* RNRandomBytes.xcodeproj */,
971EAC8723DCF75600DB5FB3 /* RNSecureKeyStore.xcodeproj */,
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */,
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
@@ -513,6 +529,15 @@
path = Pods;
sourceTree = "<group>";
};
970050872460D71500AA6E33 /* Products */ = {
isa = PBXGroup;
children = (
9700508C2460D71600AA6E33 /* libRNRandomBytes.a */,
9700508E2460D71600AA6E33 /* libRNRandomBytes-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
};
971EAC8823DCF75600DB5FB3 /* Products */ = {
isa = PBXGroup;
children = (
@@ -746,6 +771,10 @@
ProductGroup = 139FDEE71B06529A00C62182 /* Products */;
ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
},
{
ProductGroup = 970050872460D71500AA6E33 /* Products */;
ProjectRef = 970050862460D71500AA6E33 /* RNRandomBytes.xcodeproj */;
},
{
ProductGroup = 971EAC8823DCF75600DB5FB3 /* Products */;
ProjectRef = 971EAC8723DCF75600DB5FB3 /* RNSecureKeyStore.xcodeproj */;
@@ -895,6 +924,20 @@
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
9700508C2460D71600AA6E33 /* libRNRandomBytes.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNRandomBytes.a;
remoteRef = 9700508B2460D71600AA6E33 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
9700508E2460D71600AA6E33 /* libRNRandomBytes-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libRNRandomBytes-tvOS.a";
remoteRef = 9700508D2460D71600AA6E33 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
971EAC8D23DCF75600DB5FB3 /* libRNSecureKeyStore.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
+8 -9
View File
@@ -104,16 +104,15 @@ export default class TransactionsStore {
};
} else {
if (pubkey) {
let preimage;
RNRandomBytes.randomBytes(preimageByteLength), (err, bytes) => {
preimage = bytes;
});
RNRandomBytes.randomBytes(preimageByteLength, (err, preimage) => {
const secret = preimage.toString('hex');
data = {
amt: amount,
dest: pubkey,
dest_custom_records: [{ type: keySendPreimageType, value: secret }]
};
data = {
amt: amount,
dest_string: pubkey,
dest_custom_records: [{ type: keySendPreimageType, value: secret }]
};
});
} else {
if (amount) {
data = {