Daniel Torres 6 anni fa
parent
commit
43b06c10f8

+ 1 - 0
.gitattributes

@@ -0,0 +1 @@
+*.pbxproj -text

+ 46 - 0
.gitignore

@@ -0,0 +1,46 @@
+
+# OSX
+#
+.DS_Store
+
+# node.js
+#
+node_modules/
+npm-debug.log
+yarn-error.log
+  
+
+# Xcode
+#
+build/
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata
+*.xccheckout
+*.moved-aside
+DerivedData
+*.hmap
+*.ipa
+*.xcuserstate
+project.xcworkspace
+      
+
+# Android/IntelliJ
+#
+build/
+.idea
+.gradle
+local.properties
+*.iml
+
+# BUCK
+buck-out/
+\.buckd/
+*.keystore
+      

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Quanto Open Source
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 57 - 1
Readme.md

@@ -1,2 +1,58 @@
-# PBKDF2
+# React Native PBKDF2
 > A Password Based Key Derivation 2 (PBKDF2) algorithm for React Native
+
+[![MIT License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://tldrlegal.com/license/mit-license)
+
+PBKDF2 (Password-Based Key Derivation Function 2) are key derivation functions with a sliding computational cost, aimed to reduce the vulnerability of encrypted keys to brute force attacks.
+
+PBKDF2 applies a pseudorandom function, such as hash-based message authentication code (HMAC), to the input password or passphrase along with a salt value and repeats the process many times to produce a derived key, which can then be used as a cryptographic key in subsequent operations. The added computational work makes password cracking much more difficult, and is known as key stretching.
+
+## Motivation
+The motivation for create this _lib_ is to make a isolated and native way to use PBKDF2 algorithm in React Native. Because it's more simple to usage and maintain. The existent _libs_ today or are not using native code or don't keep a semantic, isolated and clean usage.
+
+The _lib_ [PublicaIO/react-native-pbkdf2](https://github.com/PublicaIO/react-native-pbkdf2), for example, not use the native code and the [react-native-aes](https://github.com/tectiv3/react-native-aes) contain some other methods
+
+> This _lib_ is totally based on [react-native-aes](https://github.com/tectiv3/react-native-aes), but with some improvements like `iteration` param suppport.
+
+## Getting started
+
+`$ yarn add https://github.com/quan-to/react-native-pbkdf2`
+
+### Linking
+
+`$ react-native link react-native-pbkdf2`
+
+### Manual installation
+
+
+#### iOS
+
+1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
+2. Go to `node_modules` ➜ `react-native-pbkdf2` and add `RNPBKDF2.xcodeproj`
+3. In XCode, in the project navigator, select your project. Add `libRCTPBKDF2.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
+4. Run your project (`Cmd+R`)<
+
+#### Android
+
+1. Open up `android/app/src/main/java/[...]/MainActivity.java`
+  - Add `import rnpbkdf2.PBKDF2;` to the imports at the top of the file
+  - Add `new PBKDF2Package()` to the list returned by the `getPackages()` method
+2. Append the following lines to `android/settings.gradle`:
+  	```
+  	include ':react-native-pbkdf2'
+  	project(':react-native-pbkdf2').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-pbkdf2/android')
+  	```
+3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
+  	```
+      compile project(':react-native-pbkdf2')
+  	```
+
+
+## Usage
+```javascript
+import PBKDF2 from 'react-native-pbkdf2'
+
+PBKDF2.derivationKey('P4S5W0RD', '032145', 10000)
+  .then((derivationKey) => console.log(derivationKey))
+  .catch(...)
+```

+ 28 - 0
android/build.gradle

@@ -0,0 +1,28 @@
+apply plugin: 'com.android.library'
+
+android {
+    compileSdkVersion 26
+    buildToolsVersion "26.0.1"
+
+    defaultConfig {
+        minSdkVersion 19
+        targetSdkVersion 22
+        versionCode 1
+        versionName "1.0"
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile 'com.android.support:appcompat-v7:23.0.1'
+    compile 'com.facebook.react:react-native:+'
+    compile 'com.madgag.spongycastle:core:1.58.0.0'
+    compile 'com.madgag.spongycastle:prov:1.54.0.0'
+    compile 'com.madgag.spongycastle:pkix:1.54.0.0'
+    compile 'com.madgag.spongycastle:pg:1.54.0.0'
+}

+ 3 - 0
android/src/main/AndroidManifest.xml

@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="rnpbkdf2">
+</manifest>

+ 84 - 0
android/src/main/java/rnpbkdf2/PBKDF2.java

@@ -0,0 +1,84 @@
+package pbkdf2;
+
+import android.widget.Toast;
+
+import java.io.IOException;
+import java.security.SecureRandom;
+import java.util.HashMap;
+import java.util.Map;
+
+import java.util.UUID;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.security.InvalidKeyException;
+
+import java.nio.charset.StandardCharsets;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.Mac;
+
+import org.spongycastle.crypto.digests.SHA512Digest;
+import org.spongycastle.crypto.generators.PKCS5S2ParametersGenerator;
+import org.spongycastle.crypto.params.KeyParameter;
+import org.spongycastle.util.encoders.Hex;
+
+import android.util.Base64;
+
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.bridge.Promise;
+import com.facebook.react.bridge.ReactContext;
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
+import com.facebook.react.bridge.ReactMethod;
+import com.facebook.react.bridge.Callback;
+
+public class PBKDF2 extends ReactContextBaseJavaModule {
+
+    private static final Integer SHA512_DIGEST_LENGTH = 512;
+
+    public PBKDF2(ReactApplicationContext reactContext) {
+        super(reactContext);
+    }
+
+    @Override
+    public String getName() {
+        return "PBKDF2";
+    }
+
+    @ReactMethod
+    public void derivationKey(String pwd, String salt, Integer iterations, Promise promise) {
+        try {
+            String strs = pbkdf2(pwd, salt, iterations, SHA512_DIGEST_LENGTH);
+            promise.resolve(strs);
+        } catch (Exception e) {
+            promise.reject("-1", e.getMessage());
+        }
+    }
+
+    public static String bytesToHex(byte[] bytes) {
+        final char[] hexArray = "0123456789abcdef".toCharArray();
+        char[] hexChars = new char[bytes.length * 2];
+        for ( int j = 0; j < bytes.length; j++ ) {
+            int v = bytes[j] & 0xFF;
+            hexChars[j * 2] = hexArray[v >>> 4];
+            hexChars[j * 2 + 1] = hexArray[v & 0x0F];
+        }
+        return new String(hexChars);
+    }
+
+    private static String derivationKey(String pwd, String salt, Integer cost, Integer length)
+    throws NoSuchAlgorithmException, InvalidKeySpecException
+    {
+        PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA512Digest());
+        gen.init(pwd.getBytes(StandardCharsets.UTF_8), salt.getBytes(StandardCharsets.UTF_8), cost);
+        byte[] key = ((KeyParameter) gen.generateDerivedParameters(length)).getKey();
+        return bytesToHex(key);
+    }
+}

+ 31 - 0
android/src/main/java/rnpbkdf2/PBKDF2Package.java

@@ -0,0 +1,31 @@
+package rnpbkdf2;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import com.facebook.react.ReactPackage;
+import com.facebook.react.bridge.JavaScriptModule;
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.uimanager.ViewManager;
+
+import rnpbkdf2.PBKDF2;
+
+public class PBKDF2Package implements ReactPackage {
+    @Override
+    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
+        return Arrays.<NativeModule>asList(
+                new PBKDF2(reactContext)
+        );
+    }
+
+    public List<Class<? extends JavaScriptModule>> createJSModules() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
+        return Arrays.<ViewManager>asList();
+    }
+}

+ 6 - 0
index.js

@@ -0,0 +1,6 @@
+
+import { NativeModules } from 'react-native'
+
+const { PBKDF2 } = NativeModules
+
+export default PBKDF2

+ 5 - 0
ios/RCTPBKDF2/RCTPBKDF2.h

@@ -0,0 +1,5 @@
+#import <React/RCTBridgeModule.h>
+
+@interface RCTPBKDF2 : NSObject <RCTBridgeModule>
+
+@end

+ 20 - 0
ios/RCTPBKDF2/RCTPBKDF2.m

@@ -0,0 +1,20 @@
+#import "RCTPBKDF2.h"
+#import "PBKDF2.h"
+
+@implementation RCTPBKDF2
+
+RCT_EXPORT_MODULE()
+
+RCT_EXPORT_METHOD(derivationKey:(NSString *)password salt:(NSString *)salt iterations:(nonnull NSNumber *)iterations
+                  resolver:(RCTPromiseResolveBlock)resolve
+                  rejecter:(RCTPromiseRejectBlock)reject) {
+    NSError *error = nil;
+    NSString *data = [PBKDF2 derivationKey:password salt:salt iterations: iterations];
+    if (data == nil) {
+        reject(@"keygen_fail", @"Key generation failed", error);
+    } else {
+        resolve(data);
+    }
+}
+
+@end

+ 6 - 0
ios/RCTPBKDF2/lib/PBKDF2.h

@@ -0,0 +1,6 @@
+#import <Foundation/Foundation.h>
+
+@interface PBKDF2 : NSObject
++ (NSString *) derivationKey:(NSString *)password salt: (NSString *)salt iterations: (nonnull NSNumber *)iterations;
++ (NSString *) toHex: (NSData *)nsdata;
+@end

+ 44 - 0
ios/RCTPBKDF2/lib/PBKDF2.m

@@ -0,0 +1,44 @@
+#import <CommonCrypto/CommonCryptor.h>
+#import <CommonCrypto/CommonDigest.h>
+#import <CommonCrypto/CommonKeyDerivation.h>
+
+#import "PBKDF2.h"
+
+@implementation PBKDF2
+
++ (NSString *) toHex:(NSData *)nsdata {
+    NSString * hexStr = [NSString stringWithFormat:@"%@", nsdata];
+    for(NSString * toRemove in [NSArray arrayWithObjects:@"<", @">", @" ", nil])
+        hexStr = [hexStr stringByReplacingOccurrencesOfString:toRemove withString:@""];
+    return hexStr;
+}
+
++ (NSString *) derivationKey:(NSString *)password salt: (NSString *)salt iterations: (nonnull NSNumber *)iterations {
+    // Data of String to generate Hash key(hexa decimal string).
+    NSData *passwordData = [password dataUsingEncoding:NSUTF8StringEncoding];
+    NSData *saltData = [salt dataUsingEncoding:NSUTF8StringEncoding];
+
+    // Hash key (hexa decimal) string data length.
+    NSMutableData *hashKeyData = [NSMutableData dataWithLength:CC_SHA512_DIGEST_LENGTH];
+
+    // Key Derivation using PBKDF2 algorithm.
+    int status = CCKeyDerivationPBKDF(
+                    kCCPBKDF2,
+                    passwordData.bytes,
+                    passwordData.length,
+                    saltData.bytes,
+                    saltData.length,
+                    kCCPRFHmacAlgSHA512,
+                    iterations,
+                    hashKeyData.mutableBytes,
+                    hashKeyData.length);
+
+    if (status == kCCParamError) {
+        NSLog(@"Key derivation error");
+        return @"";
+    }
+
+    return [self toHex:hashKeyData];
+}
+
+@end

+ 282 - 0
ios/RNPBKDF2.xcodeproj/project.pbxproj

@@ -0,0 +1,282 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 48;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		32D980E11BE9F11C00FA27E5 /* RCTPBKDF2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 32D980E01BE9F11C00FA27E5 /* RCTPBKDF2.h */; };
+		32D980E31BE9F11C00FA27E5 /* RCTPBKDF2.m in Sources */ = {isa = PBXBuildFile; fileRef = 32D980E21BE9F11C00FA27E5 /* RCTPBKDF2.m */; };
+		9BE20B5B1E4E1A3700696172 /* PBKDF2.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE20B5A1E4E1A3700696172 /* PBKDF2.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		32D980DB1BE9F11C00FA27E5 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = "include/$(PRODUCT_NAME)";
+			dstSubfolderSpec = 16;
+			files = (
+				32D980E11BE9F11C00FA27E5 /* RCTPBKDF2.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		32D980DD1BE9F11C00FA27E5 /* libRCTPBKDF2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPBKDF2.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		32D980E01BE9F11C00FA27E5 /* RCTPBKDF2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTPBKDF2.h; sourceTree = "<group>"; };
+		32D980E21BE9F11C00FA27E5 /* RCTPBKDF2.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTPBKDF2.m; sourceTree = "<group>"; };
+		9BE20B591E4E1A3700696172 /* PBKDF2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBKDF2.h; sourceTree = "<group>"; };
+		9BE20B5A1E4E1A3700696172 /* PBKDF2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBKDF2.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		32D980DA1BE9F11C00FA27E5 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		32D980D41BE9F11C00FA27E5 = {
+			isa = PBXGroup;
+			children = (
+				32D980DF1BE9F11C00FA27E5 /* RCTPBKDF2 */,
+				32D980DE1BE9F11C00FA27E5 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		32D980DE1BE9F11C00FA27E5 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				32D980DD1BE9F11C00FA27E5 /* libRCTPBKDF2.a */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		32D980DF1BE9F11C00FA27E5 /* RCTPBKDF2 */ = {
+			isa = PBXGroup;
+			children = (
+				32D980E01BE9F11C00FA27E5 /* RCTPBKDF2.h */,
+				32D980E21BE9F11C00FA27E5 /* RCTPBKDF2.m */,
+				32D981161BE9F1B600FA27E5 /* lib */,
+			);
+			path = RCTPBKDF2;
+			sourceTree = "<group>";
+		};
+		32D981161BE9F1B600FA27E5 /* lib */ = {
+			isa = PBXGroup;
+			children = (
+				9BE20B591E4E1A3700696172 /* PBKDF2.h */,
+				9BE20B5A1E4E1A3700696172 /* PBKDF2.m */,
+			);
+			path = lib;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		32D980DC1BE9F11C00FA27E5 /* RCTPBKDF2 */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 32D980F11BE9F11C00FA27E5 /* Build configuration list for PBXNativeTarget "RCTPBKDF2" */;
+			buildPhases = (
+				32D980D91BE9F11C00FA27E5 /* Sources */,
+				32D980DA1BE9F11C00FA27E5 /* Frameworks */,
+				32D980DB1BE9F11C00FA27E5 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = RCTPBKDF2;
+			productName = RCTPBKDF2;
+			productReference = 32D980DD1BE9F11C00FA27E5 /* libRCTPBKDF2.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		32D980D51BE9F11C00FA27E5 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0820;
+				ORGANIZATIONNAME = tectiv3;
+				TargetAttributes = {
+					32D980DC1BE9F11C00FA27E5 = {
+						CreatedOnToolsVersion = 6.4;
+					};
+				};
+			};
+			buildConfigurationList = 32D980D81BE9F11C00FA27E5 /* Build configuration list for PBXProject "RCTPBKDF2" */;
+			compatibilityVersion = "Xcode 8.0";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 32D980D41BE9F11C00FA27E5;
+			productRefGroup = 32D980DE1BE9F11C00FA27E5 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				32D980DC1BE9F11C00FA27E5 /* RCTPBKDF2 */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		32D980D91BE9F11C00FA27E5 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9BE20B5B1E4E1A3700696172 /* PBKDF2.m in Sources */,
+				32D980E31BE9F11C00FA27E5 /* RCTPBKDF2.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		32D980EF1BE9F11C00FA27E5 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				MTL_ENABLE_DEBUG_INFO = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = iphoneos;
+			};
+			name = Debug;
+		};
+		32D980F01BE9F11C00FA27E5 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				SDKROOT = iphoneos;
+				VALIDATE_PRODUCT = YES;
+			};
+			name = Release;
+		};
+		32D980F21BE9F11C00FA27E5 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+					"$(SRCROOT)/../../../react-native/React/**",
+					"$(SRCROOT)/../../../../../node_modules/react-native/React/**",
+				);
+				OTHER_LDFLAGS = "-ObjC";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SKIP_INSTALL = YES;
+			};
+			name = Debug;
+		};
+		32D980F31BE9F11C00FA27E5 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+					"$(SRCROOT)/../../../react-native/React/**",
+					"$(SRCROOT)/../../../../../node_modules/react-native/React/**",
+				);
+				OTHER_LDFLAGS = "-ObjC";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SKIP_INSTALL = YES;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		32D980D81BE9F11C00FA27E5 /* Build configuration list for PBXProject "RCTPBKDF2" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				32D980EF1BE9F11C00FA27E5 /* Debug */,
+				32D980F01BE9F11C00FA27E5 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		32D980F11BE9F11C00FA27E5 /* Build configuration list for PBXNativeTarget "RCTPBKDF2" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				32D980F21BE9F11C00FA27E5 /* Debug */,
+				32D980F31BE9F11C00FA27E5 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 32D980D51BE9F11C00FA27E5 /* Project object */;
+}

+ 15 - 0
package.json

@@ -0,0 +1,15 @@
+{
+  "name": "react-native-pbkdf2",
+  "version": "0.1.0",
+  "description": "A Password Based Key Derivation 2 (PBKDF2) algorithm for React Native",
+  "main": "index.js",
+  "keywords": [
+    "pbkdf2",
+    "react-native"
+  ],
+  "author": "Daniel Torres <danielfeelfine@gmail.com>",
+  "license": "MIT",
+  "peerDependencies": {
+    "react-native": "^0.56.0"
+  }
+}

+ 4 - 0
yarn.lock

@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+