@functionland/react-native-fula 1.12.1 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
- package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/build.gradle +70 -70
- package/android/src/main/java/land/fx/fula/Cryptography.java +62 -62
- package/android/src/main/java/land/fx/fula/FulaModule.java +1438 -1438
- package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/commonjs/protocols/fula.js +98 -98
- package/lib/commonjs/protocols/fula.js.map +1 -1
- package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/module/protocols/fula.js +98 -98
- package/lib/module/protocols/fula.js.map +1 -1
- package/package.json +157 -157
- package/src/interfaces/fulaNativeModule.ts +122 -122
- package/src/protocols/fula.ts +314 -314
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
buildscript {
|
|
2
|
-
if (project == rootProject) {
|
|
3
|
-
repositories {
|
|
4
|
-
google()
|
|
5
|
-
mavenCentral()
|
|
6
|
-
jcenter()
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
dependencies {
|
|
10
|
-
classpath 'com.android.tools.build:gradle:4.2.2'
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
apply plugin: 'com.android.library'
|
|
16
|
-
|
|
17
|
-
def safeExtGet(prop, fallback) {
|
|
18
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
android {
|
|
22
|
-
compileSdk 33
|
|
23
|
-
defaultConfig {
|
|
24
|
-
minSdkVersion safeExtGet('Fula_minSdkVersion', 26)
|
|
25
|
-
targetSdkVersion safeExtGet('Fula_targetSdkVersion', 31)
|
|
26
|
-
versionCode 1
|
|
27
|
-
versionName "1.0"
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
buildTypes {
|
|
32
|
-
release {
|
|
33
|
-
minifyEnabled false
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
lintOptions {
|
|
37
|
-
disable 'GradleCompatible'
|
|
38
|
-
}
|
|
39
|
-
compileOptions {
|
|
40
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
41
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
42
|
-
}
|
|
43
|
-
ndkVersion '25.1.8937393'
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
repositories {
|
|
47
|
-
mavenLocal()
|
|
48
|
-
google()
|
|
49
|
-
jcenter()
|
|
50
|
-
mavenCentral()
|
|
51
|
-
maven {
|
|
52
|
-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
53
|
-
url("$rootDir/../node_modules/react-native/android")
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// Add this repo to get go-fula package
|
|
59
|
-
maven { url 'https://jitpack.io' }
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
dependencies {
|
|
63
|
-
//noinspection GradleDynamicVersion
|
|
64
|
-
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
65
|
-
implementation 'com.github.functionland:fula-build-aar:1.13.
|
|
66
|
-
implementation 'com.github.functionland:wnfs-android:v1.7.3' // From jitpack.io
|
|
67
|
-
implementation 'commons-io:commons-io:20030203.000550'
|
|
68
|
-
implementation 'commons-codec:commons-codec:1.15'
|
|
69
|
-
// implementation files('mobile.aar')
|
|
70
|
-
}
|
|
1
|
+
buildscript {
|
|
2
|
+
if (project == rootProject) {
|
|
3
|
+
repositories {
|
|
4
|
+
google()
|
|
5
|
+
mavenCentral()
|
|
6
|
+
jcenter()
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
dependencies {
|
|
10
|
+
classpath 'com.android.tools.build:gradle:4.2.2'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
apply plugin: 'com.android.library'
|
|
16
|
+
|
|
17
|
+
def safeExtGet(prop, fallback) {
|
|
18
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
android {
|
|
22
|
+
compileSdk 33
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion safeExtGet('Fula_minSdkVersion', 26)
|
|
25
|
+
targetSdkVersion safeExtGet('Fula_targetSdkVersion', 31)
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
buildTypes {
|
|
32
|
+
release {
|
|
33
|
+
minifyEnabled false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
disable 'GradleCompatible'
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
42
|
+
}
|
|
43
|
+
ndkVersion '25.1.8937393'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
repositories {
|
|
47
|
+
mavenLocal()
|
|
48
|
+
google()
|
|
49
|
+
jcenter()
|
|
50
|
+
mavenCentral()
|
|
51
|
+
maven {
|
|
52
|
+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
53
|
+
url("$rootDir/../node_modules/react-native/android")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// Add this repo to get go-fula package
|
|
59
|
+
maven { url 'https://jitpack.io' }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
dependencies {
|
|
63
|
+
//noinspection GradleDynamicVersion
|
|
64
|
+
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
65
|
+
implementation 'com.github.functionland:fula-build-aar:1.13.1' // From jitpack.io
|
|
66
|
+
implementation 'com.github.functionland:wnfs-android:v1.7.3' // From jitpack.io
|
|
67
|
+
implementation 'commons-io:commons-io:20030203.000550'
|
|
68
|
+
implementation 'commons-codec:commons-codec:1.15'
|
|
69
|
+
// implementation files('mobile.aar')
|
|
70
|
+
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
package land.fx.fula;
|
|
2
|
-
|
|
3
|
-
import android.util.Base64;
|
|
4
|
-
|
|
5
|
-
import java.io.UnsupportedEncodingException;
|
|
6
|
-
import java.nio.charset.StandardCharsets;
|
|
7
|
-
import java.security.InvalidAlgorithmParameterException;
|
|
8
|
-
import java.security.InvalidKeyException;
|
|
9
|
-
import java.security.NoSuchAlgorithmException;
|
|
10
|
-
import java.security.spec.InvalidKeySpecException;
|
|
11
|
-
import java.security.SecureRandom;
|
|
12
|
-
import java.nio.ByteBuffer;
|
|
13
|
-
import java.security.spec.InvalidParameterSpecException;
|
|
14
|
-
|
|
15
|
-
import javax.crypto.BadPaddingException;
|
|
16
|
-
import javax.crypto.Cipher;
|
|
17
|
-
import javax.crypto.IllegalBlockSizeException;
|
|
18
|
-
import javax.crypto.NoSuchPaddingException;
|
|
19
|
-
import javax.crypto.SecretKey;
|
|
20
|
-
import javax.crypto.SecretKeyFactory;
|
|
21
|
-
import javax.crypto.spec.PBEKeySpec;
|
|
22
|
-
import javax.crypto.spec.SecretKeySpec;
|
|
23
|
-
import javax.crypto.spec.GCMParameterSpec;
|
|
24
|
-
|
|
25
|
-
public class Cryptography {
|
|
26
|
-
public static String encryptMsg(String message, SecretKey secret, byte[] iv)
|
|
27
|
-
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException {
|
|
28
|
-
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
|
29
|
-
if (iv == null || iv.length == 0) {
|
|
30
|
-
iv = new byte[12]; // Ensure this is randomly generated for each encryption.
|
|
31
|
-
new SecureRandom().nextBytes(iv);
|
|
32
|
-
}
|
|
33
|
-
GCMParameterSpec spec = new GCMParameterSpec(128, iv);
|
|
34
|
-
cipher.init(Cipher.ENCRYPT_MODE, secret, spec);
|
|
35
|
-
byte[] cipherText = cipher.doFinal(message.getBytes(StandardCharsets.UTF_8));
|
|
36
|
-
ByteBuffer byteBuffer = ByteBuffer.allocate(iv.length + cipherText.length);
|
|
37
|
-
byteBuffer.put(iv);
|
|
38
|
-
byteBuffer.put(cipherText);
|
|
39
|
-
return Base64.encodeToString(byteBuffer.array(), Base64.NO_WRAP);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public static String decryptMsg(String cipherText, SecretKey secret)
|
|
43
|
-
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
|
|
44
|
-
ByteBuffer byteBuffer = ByteBuffer.wrap(Base64.decode(cipherText, Base64.NO_WRAP));
|
|
45
|
-
byte[] iv = new byte[12];
|
|
46
|
-
byteBuffer.get(iv);
|
|
47
|
-
byte[] cipherBytes = new byte[byteBuffer.remaining()];
|
|
48
|
-
byteBuffer.get(cipherBytes);
|
|
49
|
-
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
|
50
|
-
GCMParameterSpec spec = new GCMParameterSpec(128, iv);
|
|
51
|
-
cipher.init(Cipher.DECRYPT_MODE, secret, spec);
|
|
52
|
-
String decryptString = new String(cipher.doFinal(cipherBytes), StandardCharsets.UTF_8);
|
|
53
|
-
return decryptString;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public static SecretKey generateKey(byte[] key)
|
|
57
|
-
throws NoSuchAlgorithmException, InvalidKeySpecException {
|
|
58
|
-
PBEKeySpec pbeKeySpec = new PBEKeySpec(StaticHelper.bytesToBase64(key).toCharArray(), key, 1000, 128);
|
|
59
|
-
SecretKey pbeKey = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(pbeKeySpec);
|
|
60
|
-
return new SecretKeySpec(pbeKey.getEncoded(), "AES");
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
package land.fx.fula;
|
|
2
|
+
|
|
3
|
+
import android.util.Base64;
|
|
4
|
+
|
|
5
|
+
import java.io.UnsupportedEncodingException;
|
|
6
|
+
import java.nio.charset.StandardCharsets;
|
|
7
|
+
import java.security.InvalidAlgorithmParameterException;
|
|
8
|
+
import java.security.InvalidKeyException;
|
|
9
|
+
import java.security.NoSuchAlgorithmException;
|
|
10
|
+
import java.security.spec.InvalidKeySpecException;
|
|
11
|
+
import java.security.SecureRandom;
|
|
12
|
+
import java.nio.ByteBuffer;
|
|
13
|
+
import java.security.spec.InvalidParameterSpecException;
|
|
14
|
+
|
|
15
|
+
import javax.crypto.BadPaddingException;
|
|
16
|
+
import javax.crypto.Cipher;
|
|
17
|
+
import javax.crypto.IllegalBlockSizeException;
|
|
18
|
+
import javax.crypto.NoSuchPaddingException;
|
|
19
|
+
import javax.crypto.SecretKey;
|
|
20
|
+
import javax.crypto.SecretKeyFactory;
|
|
21
|
+
import javax.crypto.spec.PBEKeySpec;
|
|
22
|
+
import javax.crypto.spec.SecretKeySpec;
|
|
23
|
+
import javax.crypto.spec.GCMParameterSpec;
|
|
24
|
+
|
|
25
|
+
public class Cryptography {
|
|
26
|
+
public static String encryptMsg(String message, SecretKey secret, byte[] iv)
|
|
27
|
+
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException {
|
|
28
|
+
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
|
29
|
+
if (iv == null || iv.length == 0) {
|
|
30
|
+
iv = new byte[12]; // Ensure this is randomly generated for each encryption.
|
|
31
|
+
new SecureRandom().nextBytes(iv);
|
|
32
|
+
}
|
|
33
|
+
GCMParameterSpec spec = new GCMParameterSpec(128, iv);
|
|
34
|
+
cipher.init(Cipher.ENCRYPT_MODE, secret, spec);
|
|
35
|
+
byte[] cipherText = cipher.doFinal(message.getBytes(StandardCharsets.UTF_8));
|
|
36
|
+
ByteBuffer byteBuffer = ByteBuffer.allocate(iv.length + cipherText.length);
|
|
37
|
+
byteBuffer.put(iv);
|
|
38
|
+
byteBuffer.put(cipherText);
|
|
39
|
+
return Base64.encodeToString(byteBuffer.array(), Base64.NO_WRAP);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public static String decryptMsg(String cipherText, SecretKey secret)
|
|
43
|
+
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
|
|
44
|
+
ByteBuffer byteBuffer = ByteBuffer.wrap(Base64.decode(cipherText, Base64.NO_WRAP));
|
|
45
|
+
byte[] iv = new byte[12];
|
|
46
|
+
byteBuffer.get(iv);
|
|
47
|
+
byte[] cipherBytes = new byte[byteBuffer.remaining()];
|
|
48
|
+
byteBuffer.get(cipherBytes);
|
|
49
|
+
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
|
50
|
+
GCMParameterSpec spec = new GCMParameterSpec(128, iv);
|
|
51
|
+
cipher.init(Cipher.DECRYPT_MODE, secret, spec);
|
|
52
|
+
String decryptString = new String(cipher.doFinal(cipherBytes), StandardCharsets.UTF_8);
|
|
53
|
+
return decryptString;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static SecretKey generateKey(byte[] key)
|
|
57
|
+
throws NoSuchAlgorithmException, InvalidKeySpecException {
|
|
58
|
+
PBEKeySpec pbeKeySpec = new PBEKeySpec(StaticHelper.bytesToBase64(key).toCharArray(), key, 1000, 128);
|
|
59
|
+
SecretKey pbeKey = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(pbeKeySpec);
|
|
60
|
+
return new SecretKeySpec(pbeKey.getEncoded(), "AES");
|
|
61
|
+
}
|
|
62
|
+
}
|