@functionland/react-native-fula 1.2.1001 → 1.9.0

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.
Files changed (53) hide show
  1. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  3. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  4. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  5. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  6. package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
  7. package/android/.gradle/7.6/checksums/checksums.lock +0 -0
  8. package/android/.gradle/7.6/checksums/md5-checksums.bin +0 -0
  9. package/android/.gradle/7.6/checksums/sha1-checksums.bin +0 -0
  10. package/android/.gradle/7.6/dependencies-accessors/dependencies-accessors.lock +0 -0
  11. package/android/.gradle/7.6/dependencies-accessors/gc.properties +0 -0
  12. package/android/.gradle/7.6/executionHistory/executionHistory.bin +0 -0
  13. package/android/.gradle/7.6/executionHistory/executionHistory.lock +0 -0
  14. package/android/.gradle/7.6/fileChanges/last-build.bin +0 -0
  15. package/android/.gradle/7.6/fileHashes/fileHashes.bin +0 -0
  16. package/android/.gradle/7.6/fileHashes/fileHashes.lock +0 -0
  17. package/android/.gradle/7.6/fileHashes/resourceHashesCache.bin +0 -0
  18. package/android/.gradle/7.6/gc.properties +0 -0
  19. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  20. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  21. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  22. package/android/.gradle/file-system.probe +0 -0
  23. package/android/build.gradle +69 -69
  24. package/android/src/main/java/land/fx/fula/Cryptography.java +60 -47
  25. package/android/src/main/java/land/fx/fula/FulaModule.java +1384 -1297
  26. package/lib/commonjs/index.js +3 -1
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  29. package/lib/commonjs/protocols/blockchain.js +12 -12
  30. package/lib/commonjs/protocols/blockchain.js.map +1 -1
  31. package/lib/commonjs/protocols/fxblox.js +52 -0
  32. package/lib/commonjs/protocols/fxblox.js.map +1 -0
  33. package/lib/commonjs/types/fxblox.js +2 -0
  34. package/lib/commonjs/types/fxblox.js.map +1 -0
  35. package/lib/module/index.js +2 -0
  36. package/lib/module/index.js.map +1 -1
  37. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  38. package/lib/module/protocols/blockchain.js +12 -12
  39. package/lib/module/protocols/blockchain.js.map +1 -1
  40. package/lib/module/protocols/fxblox.js +43 -0
  41. package/lib/module/protocols/fxblox.js.map +1 -0
  42. package/lib/module/types/fxblox.js +2 -0
  43. package/lib/module/types/fxblox.js.map +1 -0
  44. package/lib/typescript/index.d.ts +1 -0
  45. package/lib/typescript/interfaces/fulaNativeModule.d.ts +2 -0
  46. package/lib/typescript/protocols/fxblox.d.ts +7 -0
  47. package/lib/typescript/types/fxblox.d.ts +8 -0
  48. package/package.json +1 -1
  49. package/src/index.tsx +2 -1
  50. package/src/interfaces/fulaNativeModule.ts +41 -8
  51. package/src/protocols/blockchain.ts +318 -274
  52. package/src/protocols/fxblox.ts +49 -0
  53. package/src/types/fxblox.ts +8 -0
File without changes
@@ -1,2 +1,2 @@
1
- #Sat Dec 17 20:00:09 EST 2022
1
+ #Sun May 28 11:39:35 IRDT 2023
2
2
  gradle.version=7.5.1
Binary file
@@ -1,69 +1,69 @@
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.2.1' // From jitpack.io
66
- implementation 'com.github.functionland:wnfs-build-aar:v1.4.1' // From jitpack.io
67
- implementation 'commons-io:commons-io:20030203.000550'
68
- // implementation files('mobile.aar')
69
- }
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.9.0' // From jitpack.io
66
+ implementation 'com.github.functionland:wnfs-build-aar:v1.4.1' // From jitpack.io
67
+ implementation 'commons-io:commons-io:20030203.000550'
68
+ // implementation files('mobile.aar')
69
+ }
@@ -1,47 +1,60 @@
1
- package land.fx.fula;
2
-
3
- import android.util.Base64;
4
-
5
- import java.io.UnsupportedEncodingException;
6
- import java.security.InvalidAlgorithmParameterException;
7
- import java.security.InvalidKeyException;
8
- import java.security.NoSuchAlgorithmException;
9
- import java.security.spec.InvalidKeySpecException;
10
- import java.security.spec.InvalidParameterSpecException;
11
-
12
- import javax.crypto.BadPaddingException;
13
- import javax.crypto.Cipher;
14
- import javax.crypto.IllegalBlockSizeException;
15
- import javax.crypto.NoSuchPaddingException;
16
- import javax.crypto.SecretKey;
17
- import javax.crypto.SecretKeyFactory;
18
- import javax.crypto.spec.PBEKeySpec;
19
- import javax.crypto.spec.SecretKeySpec;
20
-
21
- public class Cryptography {
22
- public static String encryptMsg(String message, SecretKey secret)
23
- throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidParameterSpecException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
24
- Cipher cipher = null;
25
- cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
26
- cipher.init(Cipher.ENCRYPT_MODE, secret);
27
- byte[] cipherText = cipher.doFinal(message.getBytes("UTF-8"));
28
- return Base64.encodeToString(cipherText, Base64.NO_WRAP);
29
- }
30
-
31
- public static String decryptMsg(String cipherText, SecretKey secret)
32
- throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidParameterSpecException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, UnsupportedEncodingException {
33
- Cipher cipher = null;
34
- cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
35
- cipher.init(Cipher.DECRYPT_MODE, secret);
36
- byte[] decode = Base64.decode(cipherText, Base64.NO_WRAP);
37
- String decryptString = new String(cipher.doFinal(decode), "UTF-8");
38
- return decryptString;
39
- }
40
-
41
- public static SecretKey generateKey(byte[] key)
42
- throws NoSuchAlgorithmException, InvalidKeySpecException {
43
- PBEKeySpec pbeKeySpec = new PBEKeySpec(StaticHelper.bytesToBase64(key).toCharArray(), key, 1000, 128);
44
- SecretKey pbeKey = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(pbeKeySpec);
45
- return new SecretKeySpec(pbeKey.getEncoded(), "AES");
46
- }
47
- }
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)
27
+ throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException {
28
+ Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
29
+ byte[] iv = new byte[12]; // Ensure this is randomly generated for each encryption.
30
+ new SecureRandom().nextBytes(iv);
31
+ GCMParameterSpec spec = new GCMParameterSpec(128, iv);
32
+ cipher.init(Cipher.ENCRYPT_MODE, secret, spec);
33
+ byte[] cipherText = cipher.doFinal(message.getBytes(StandardCharsets.UTF_8));
34
+ ByteBuffer byteBuffer = ByteBuffer.allocate(iv.length + cipherText.length);
35
+ byteBuffer.put(iv);
36
+ byteBuffer.put(cipherText);
37
+ return Base64.encodeToString(byteBuffer.array(), Base64.NO_WRAP);
38
+ }
39
+
40
+ public static String decryptMsg(String cipherText, SecretKey secret)
41
+ throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
42
+ ByteBuffer byteBuffer = ByteBuffer.wrap(Base64.decode(cipherText, Base64.NO_WRAP));
43
+ byte[] iv = new byte[12];
44
+ byteBuffer.get(iv);
45
+ byte[] cipherBytes = new byte[byteBuffer.remaining()];
46
+ byteBuffer.get(cipherBytes);
47
+ Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
48
+ GCMParameterSpec spec = new GCMParameterSpec(128, iv);
49
+ cipher.init(Cipher.DECRYPT_MODE, secret, spec);
50
+ String decryptString = new String(cipher.doFinal(cipherBytes), StandardCharsets.UTF_8);
51
+ return decryptString;
52
+ }
53
+
54
+ public static SecretKey generateKey(byte[] key)
55
+ throws NoSuchAlgorithmException, InvalidKeySpecException {
56
+ PBEKeySpec pbeKeySpec = new PBEKeySpec(StaticHelper.bytesToBase64(key).toCharArray(), key, 1000, 128);
57
+ SecretKey pbeKey = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(pbeKeySpec);
58
+ return new SecretKeySpec(pbeKey.getEncoded(), "AES");
59
+ }
60
+ }