moved android implementation from /app to /android, rnpm link did not find the android implementation from app -directory.

This commit is contained in:
Esa Riihinen
2016-05-27 12:04:03 +03:00
parent 394c16968d
commit 6a694b6ed1
4 changed files with 0 additions and 0 deletions
@@ -0,0 +1,31 @@
package com.bitgo.randombytes;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import java.security.SecureRandom;
import android.util.Base64;
class RandomBytesModule extends ReactContextBaseJavaModule {
public RandomBytesModule(ReactApplicationContext reactContext) {
super(reactContext);
}
@Override
public String getName() {
return "RNRandomBytes";
}
@ReactMethod
public void randomBytes(int size, Callback success) {
SecureRandom sr = new SecureRandom();
byte[] output = new byte[size];
sr.nextBytes(output);
String string = Base64.encodeToString(output, Base64.DEFAULT);
success.invoke(null, string);
}
}