@functionland/react-native-fula 1.55.12 → 1.55.16

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 (97) hide show
  1. package/LICENSE +20 -20
  2. package/android/build.gradle +114 -114
  3. package/android/gradle.properties +8 -8
  4. package/android/src/main/AndroidManifest.xml +3 -3
  5. package/android/src/main/AndroidManifestNew.xml +2 -2
  6. package/android/src/main/java/land/fx/fula/ConfigRef.java +7 -7
  7. package/android/src/main/java/land/fx/fula/Cryptography.java +62 -62
  8. package/android/src/main/java/land/fx/fula/FulaModule.java +2057 -1991
  9. package/android/src/main/java/land/fx/fula/FulaPackage.java +32 -32
  10. package/android/src/main/java/land/fx/fula/SharedPreferenceHelper.java +65 -65
  11. package/android/src/main/java/land/fx/fula/StaticHelper.java +13 -13
  12. package/android/src/main/java/land/fx/fula/ThreadUtils.java +42 -42
  13. package/ios/Cryptography.swift +59 -59
  14. package/ios/Fula-Bridging-Header.h +3 -3
  15. package/ios/Fula.mm +272 -262
  16. package/ios/Fula.swift +2284 -2207
  17. package/ios/Fula.xcodeproj/project.pbxproj +2 -2
  18. package/ios/UserDataHelper.swift +143 -143
  19. package/lib/commonjs/index.js +1 -2
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/interfaces/augment-api-consts.js.map +1 -1
  22. package/lib/commonjs/interfaces/augment-api-errors.js.map +1 -1
  23. package/lib/commonjs/interfaces/augment-api-events.js.map +1 -1
  24. package/lib/commonjs/interfaces/augment-api-query.js.map +1 -1
  25. package/lib/commonjs/interfaces/augment-api-rpc.js.map +1 -1
  26. package/lib/commonjs/interfaces/augment-api-runtime.js.map +1 -1
  27. package/lib/commonjs/interfaces/augment-api-tx.js.map +1 -1
  28. package/lib/commonjs/interfaces/augment-api.js.map +1 -1
  29. package/lib/commonjs/interfaces/augment-types.js.map +1 -1
  30. package/lib/commonjs/interfaces/definitions.js.map +1 -1
  31. package/lib/commonjs/interfaces/defintions.js.map +1 -1
  32. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  33. package/lib/commonjs/interfaces/index.js.map +1 -1
  34. package/lib/commonjs/interfaces/lookup.js +300 -300
  35. package/lib/commonjs/interfaces/lookup.js.map +1 -1
  36. package/lib/commonjs/interfaces/registry.js.map +1 -1
  37. package/lib/commonjs/interfaces/types-lookup.js.map +1 -1
  38. package/lib/commonjs/interfaces/types.js.map +1 -1
  39. package/lib/commonjs/protocols/blockchain.js +133 -67
  40. package/lib/commonjs/protocols/blockchain.js.map +1 -1
  41. package/lib/commonjs/protocols/chain-api.js.map +1 -1
  42. package/lib/commonjs/protocols/fula.js.map +1 -1
  43. package/lib/commonjs/protocols/fx-ai.js.map +1 -1
  44. package/lib/commonjs/protocols/fxblox.js +3 -3
  45. package/lib/commonjs/protocols/fxblox.js.map +1 -1
  46. package/lib/commonjs/types/blockchain.js.map +1 -1
  47. package/lib/commonjs/types/fxblox.js.map +1 -1
  48. package/lib/module/index.js.map +1 -1
  49. package/lib/module/interfaces/augment-api-consts.js.map +1 -1
  50. package/lib/module/interfaces/augment-api-errors.js.map +1 -1
  51. package/lib/module/interfaces/augment-api-events.js.map +1 -1
  52. package/lib/module/interfaces/augment-api-query.js.map +1 -1
  53. package/lib/module/interfaces/augment-api-rpc.js.map +1 -1
  54. package/lib/module/interfaces/augment-api-runtime.js.map +1 -1
  55. package/lib/module/interfaces/augment-api-tx.js.map +1 -1
  56. package/lib/module/interfaces/augment-api.js.map +1 -1
  57. package/lib/module/interfaces/augment-types.js.map +1 -1
  58. package/lib/module/interfaces/definitions.js.map +1 -1
  59. package/lib/module/interfaces/defintions.js.map +1 -1
  60. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  61. package/lib/module/interfaces/index.js.map +1 -1
  62. package/lib/module/interfaces/lookup.js +300 -300
  63. package/lib/module/interfaces/lookup.js.map +1 -1
  64. package/lib/module/interfaces/registry.js.map +1 -1
  65. package/lib/module/interfaces/types-lookup.js.map +1 -1
  66. package/lib/module/interfaces/types.js.map +1 -1
  67. package/lib/module/protocols/blockchain.js +130 -66
  68. package/lib/module/protocols/blockchain.js.map +1 -1
  69. package/lib/module/protocols/chain-api.js.map +1 -1
  70. package/lib/module/protocols/fula.js.map +1 -1
  71. package/lib/module/protocols/fx-ai.js.map +1 -1
  72. package/lib/module/protocols/fxblox.js +3 -3
  73. package/lib/module/protocols/fxblox.js.map +1 -1
  74. package/lib/module/types/blockchain.js.map +1 -1
  75. package/lib/module/types/fxblox.js.map +1 -1
  76. package/package.json +177 -176
  77. package/react-native-fula.podspec +47 -47
  78. package/src/index.tsx +4 -4
  79. package/src/interfaces/augment-api-consts.ts +273 -273
  80. package/src/interfaces/augment-api-errors.ts +474 -474
  81. package/src/interfaces/augment-api-events.ts +448 -448
  82. package/src/interfaces/augment-api-query.ts +466 -466
  83. package/src/interfaces/augment-api-rpc.ts +617 -617
  84. package/src/interfaces/augment-api-runtime.ts +223 -223
  85. package/src/interfaces/augment-api-tx.ts +709 -709
  86. package/src/interfaces/augment-api.ts +9 -9
  87. package/src/interfaces/augment-types.ts +1322 -1322
  88. package/src/interfaces/definitions.ts +1 -1
  89. package/src/interfaces/defintions.ts +1 -1
  90. package/src/interfaces/fulaNativeModule.ts +177 -175
  91. package/src/interfaces/index.ts +3 -3
  92. package/src/interfaces/lookup.ts +2011 -2011
  93. package/src/interfaces/registry.ts +163 -163
  94. package/src/interfaces/types-lookup.ts +2165 -2165
  95. package/src/interfaces/types.ts +2 -2
  96. package/src/protocols/blockchain.ts +716 -644
  97. package/src/protocols/fxblox.ts +442 -442
@@ -1,32 +1,32 @@
1
- package land.fx.fula;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.ReactPackage;
6
- import com.facebook.react.bridge.NativeModule;
7
- import com.facebook.react.bridge.ReactApplicationContext;
8
- import com.facebook.react.uimanager.ViewManager;
9
-
10
- import java.util.ArrayList;
11
- import java.util.Collections;
12
- import java.util.List;
13
-
14
- public class FulaPackage implements ReactPackage {
15
- @NonNull
16
- @Override
17
- public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
- List<NativeModule> modules = new ArrayList<>();
19
- try {
20
- modules.add(new FulaModule(reactContext));
21
- } catch (Exception e) {
22
- e.printStackTrace();
23
- }
24
- return modules;
25
- }
26
-
27
- @NonNull
28
- @Override
29
- public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
30
- return Collections.emptyList();
31
- }
32
- }
1
+ package land.fx.fula;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collections;
12
+ import java.util.List;
13
+
14
+ public class FulaPackage implements ReactPackage {
15
+ @NonNull
16
+ @Override
17
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
+ List<NativeModule> modules = new ArrayList<>();
19
+ try {
20
+ modules.add(new FulaModule(reactContext));
21
+ } catch (Exception e) {
22
+ e.printStackTrace();
23
+ }
24
+ return modules;
25
+ }
26
+
27
+ @NonNull
28
+ @Override
29
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
30
+ return Collections.emptyList();
31
+ }
32
+ }
@@ -1,65 +1,65 @@
1
- package land.fx.fula;
2
-
3
- import static android.content.Context.MODE_PRIVATE;
4
-
5
- import android.content.Context;
6
- import android.content.SharedPreferences;
7
- import android.util.Log;
8
-
9
- public class SharedPreferenceHelper {
10
- private static SharedPreferenceHelper me;
11
- private static String sharedPrefName;
12
- private static Context context;
13
-
14
- private SharedPreferenceHelper() {
15
- }
16
-
17
- public static SharedPreferenceHelper getInstance(Context cntx) {
18
- if (me == null) {
19
- me = new SharedPreferenceHelper();
20
- }
21
- context = cntx;
22
- sharedPrefName = "APP_KEY_PAIR_VALUE";
23
- return me;
24
- }
25
-
26
- public String getValue(String key) {
27
- SharedPreferences prefs = context.getSharedPreferences(sharedPrefName, MODE_PRIVATE);
28
- return prefs.getString(key, null);
29
- }
30
-
31
- public boolean getBooleanValue(String key) {
32
- SharedPreferences prefs = context.getSharedPreferences(sharedPrefName, MODE_PRIVATE);
33
- return prefs.getBoolean(key, false);
34
- }
35
-
36
- public SharedPreferenceHelper add(String key, String value) {
37
- try {
38
- context.getSharedPreferences(sharedPrefName, MODE_PRIVATE).edit().putString(key, value).apply();
39
- return me;
40
- } catch (Exception ex) {
41
- Log.e("React-Native-Fula", "SharedPrefHandler: AddSharedPref: Exception: " + ex.getMessage(), ex);
42
- throw ex;
43
- }
44
- }
45
-
46
- public SharedPreferenceHelper add(String key, boolean value) {
47
- try {
48
- context.getSharedPreferences(sharedPrefName, MODE_PRIVATE).edit().putBoolean(key, value).apply();
49
- return me;
50
- } catch (Exception e) {
51
- Log.e("React-Native-Fula", "SharedPrefHandler: AddSharedPref: Exception: " + e.getMessage(), e);
52
- throw e;
53
- }
54
- }
55
-
56
- public SharedPreferenceHelper remove(String key) {
57
- try {
58
- context.getSharedPreferences(sharedPrefName, MODE_PRIVATE).edit().remove(key).apply();
59
- return me;
60
- } catch (Exception ex) {
61
- Log.e("React-Native-Fula", "SharedPrefHandler: AddSharedPref: Exception: " + ex.getMessage(), ex);
62
- throw ex;
63
- }
64
- }
65
- }
1
+ package land.fx.fula;
2
+
3
+ import static android.content.Context.MODE_PRIVATE;
4
+
5
+ import android.content.Context;
6
+ import android.content.SharedPreferences;
7
+ import android.util.Log;
8
+
9
+ public class SharedPreferenceHelper {
10
+ private static SharedPreferenceHelper me;
11
+ private static String sharedPrefName;
12
+ private static Context context;
13
+
14
+ private SharedPreferenceHelper() {
15
+ }
16
+
17
+ public static SharedPreferenceHelper getInstance(Context cntx) {
18
+ if (me == null) {
19
+ me = new SharedPreferenceHelper();
20
+ }
21
+ context = cntx;
22
+ sharedPrefName = "APP_KEY_PAIR_VALUE";
23
+ return me;
24
+ }
25
+
26
+ public String getValue(String key) {
27
+ SharedPreferences prefs = context.getSharedPreferences(sharedPrefName, MODE_PRIVATE);
28
+ return prefs.getString(key, null);
29
+ }
30
+
31
+ public boolean getBooleanValue(String key) {
32
+ SharedPreferences prefs = context.getSharedPreferences(sharedPrefName, MODE_PRIVATE);
33
+ return prefs.getBoolean(key, false);
34
+ }
35
+
36
+ public SharedPreferenceHelper add(String key, String value) {
37
+ try {
38
+ context.getSharedPreferences(sharedPrefName, MODE_PRIVATE).edit().putString(key, value).apply();
39
+ return me;
40
+ } catch (Exception ex) {
41
+ Log.e("React-Native-Fula", "SharedPrefHandler: AddSharedPref: Exception: " + ex.getMessage(), ex);
42
+ throw ex;
43
+ }
44
+ }
45
+
46
+ public SharedPreferenceHelper add(String key, boolean value) {
47
+ try {
48
+ context.getSharedPreferences(sharedPrefName, MODE_PRIVATE).edit().putBoolean(key, value).apply();
49
+ return me;
50
+ } catch (Exception e) {
51
+ Log.e("React-Native-Fula", "SharedPrefHandler: AddSharedPref: Exception: " + e.getMessage(), e);
52
+ throw e;
53
+ }
54
+ }
55
+
56
+ public SharedPreferenceHelper remove(String key) {
57
+ try {
58
+ context.getSharedPreferences(sharedPrefName, MODE_PRIVATE).edit().remove(key).apply();
59
+ return me;
60
+ } catch (Exception ex) {
61
+ Log.e("React-Native-Fula", "SharedPrefHandler: AddSharedPref: Exception: " + ex.getMessage(), ex);
62
+ throw ex;
63
+ }
64
+ }
65
+ }
@@ -1,13 +1,13 @@
1
- package land.fx.fula;
2
-
3
- import java.util.Base64;
4
-
5
- public class StaticHelper {
6
- public static String bytesToBase64(byte[] bytes) {
7
- return Base64.getEncoder().encodeToString(bytes);
8
- }
9
-
10
- public static byte[] base64ToBytes(String base64) {
11
- return Base64.getDecoder().decode(base64);
12
- }
13
- }
1
+ package land.fx.fula;
2
+
3
+ import java.util.Base64;
4
+
5
+ public class StaticHelper {
6
+ public static String bytesToBase64(byte[] bytes) {
7
+ return Base64.getEncoder().encodeToString(bytes);
8
+ }
9
+
10
+ public static byte[] base64ToBytes(String base64) {
11
+ return Base64.getDecoder().decode(base64);
12
+ }
13
+ }
@@ -1,42 +1,42 @@
1
- package land.fx.fula;
2
-
3
- import java.util.concurrent.Callable;
4
- import java.util.concurrent.ExecutorService;
5
- import java.util.concurrent.Executors;
6
- import java.util.concurrent.Future;
7
-
8
- final class ThreadUtils {
9
- /**
10
- * Thread which will be used to call all APIs. They
11
- * they don't run on the calling thread anyway, we are deferring the calls
12
- * to this thread to avoid (potentially) blocking the calling thread.
13
- */
14
- private static final ExecutorService executor
15
- = Executors.newSingleThreadExecutor();
16
-
17
- /**
18
- * Runs the given {@link Runnable} on the executor.
19
- * @param runnable
20
- */
21
- public static void runOnExecutor(Runnable runnable) {
22
- executor.execute(runnable);
23
- }
24
-
25
- /**
26
- * Submits the given {@link Callable} to be run on the executor.
27
- * @param callable
28
- * @return Future.
29
- */
30
- public static <T> Future<T> submitToExecutor(Callable<T> callable) {
31
- return executor.submit(callable);
32
- }
33
-
34
- /**
35
- * Submits the given {@link Runnable} to be run on the executor.
36
- * @param runnable
37
- * @return Future.
38
- */
39
- public static Future<?> submitToExecutor(Runnable runnable) {
40
- return executor.submit(runnable);
41
- }
42
- }
1
+ package land.fx.fula;
2
+
3
+ import java.util.concurrent.Callable;
4
+ import java.util.concurrent.ExecutorService;
5
+ import java.util.concurrent.Executors;
6
+ import java.util.concurrent.Future;
7
+
8
+ final class ThreadUtils {
9
+ /**
10
+ * Thread which will be used to call all APIs. They
11
+ * they don't run on the calling thread anyway, we are deferring the calls
12
+ * to this thread to avoid (potentially) blocking the calling thread.
13
+ */
14
+ private static final ExecutorService executor
15
+ = Executors.newSingleThreadExecutor();
16
+
17
+ /**
18
+ * Runs the given {@link Runnable} on the executor.
19
+ * @param runnable
20
+ */
21
+ public static void runOnExecutor(Runnable runnable) {
22
+ executor.execute(runnable);
23
+ }
24
+
25
+ /**
26
+ * Submits the given {@link Callable} to be run on the executor.
27
+ * @param callable
28
+ * @return Future.
29
+ */
30
+ public static <T> Future<T> submitToExecutor(Callable<T> callable) {
31
+ return executor.submit(callable);
32
+ }
33
+
34
+ /**
35
+ * Submits the given {@link Runnable} to be run on the executor.
36
+ * @param runnable
37
+ * @return Future.
38
+ */
39
+ public static Future<?> submitToExecutor(Runnable runnable) {
40
+ return executor.submit(runnable);
41
+ }
42
+ }
@@ -1,59 +1,59 @@
1
- import Foundation
2
- import CryptoSwift
3
- import os.log
4
-
5
- public class Cryptography {
6
- // AES/GCM Encryption with IV handling
7
- public static func encryptMsg(_ message: [UInt8], _ secretKey: [UInt8], _ providedIv: [UInt8]? = nil) throws -> String {
8
- var iv = providedIv ?? [UInt8](repeating: 0, count: 12) // Default IV value
9
- if iv.isEmpty {
10
- iv = AES.randomIV(12) // Generate a random IV if not provided or if empty
11
- }
12
-
13
- let gcm = GCM(iv: iv, mode: .combined)
14
- let aes = try AES(key: secretKey, blockMode: gcm, padding: .noPadding)
15
-
16
- let encrypted = try aes.encrypt(message)
17
- let encryptedDataWithIv = Data(iv + encrypted) // Prepend IV to the encrypted data
18
- return encryptedDataWithIv.base64EncodedString()
19
- }
20
-
21
- // AES/GCM Decryption with IV extracted from the beginning of the cipherText
22
- public static func decryptMsg(_ cipherText: String, _ secretKey: [UInt8]) throws -> [UInt8] {
23
- guard let encryptedDataWithIv = Data(base64Encoded: cipherText) else {
24
- throw NSError(domain: "DecryptionError", code: -1, userInfo: nil)
25
- }
26
- let iv = Array(encryptedDataWithIv.prefix(12)) // Extract IV (first 12 bytes)
27
- let encryptedData = Array(encryptedDataWithIv.dropFirst(12)) // The rest is the encrypted data
28
-
29
- let gcm = GCM(iv: iv, mode: .combined)
30
- let aes = try AES(key: secretKey, blockMode: gcm, padding: .noPadding)
31
-
32
- let decrypted = try aes.decrypt(encryptedData)
33
- return decrypted
34
- }
35
-
36
- // Key Generation matching Java's logic
37
- public static func generateKey(_ identity: Data) throws -> Data {
38
- // Transform identity to base64 string to mimic Java's behavior
39
- let passwordString = identity.base64EncodedString()
40
- let passwordData = Array(passwordString.utf8) // Convert to byte array
41
-
42
- // Use identity itself as salt for simplicity to mimic Java behavior
43
- let salt = Array(identity)
44
-
45
- do {
46
- let key = try PKCS5.PBKDF2(
47
- password: passwordData,
48
- salt: salt,
49
- iterations: 1000, // Adjust the iteration count as needed
50
- keyLength: 16, // AES-128
51
- variant: .sha256
52
- ).calculate()
53
-
54
- return Data(key)
55
- } catch {
56
- throw error // Propagate error
57
- }
58
- }
59
- }
1
+ import Foundation
2
+ import CryptoSwift
3
+ import os.log
4
+
5
+ public class Cryptography {
6
+ // AES/GCM Encryption with IV handling
7
+ public static func encryptMsg(_ message: [UInt8], _ secretKey: [UInt8], _ providedIv: [UInt8]? = nil) throws -> String {
8
+ var iv = providedIv ?? [UInt8](repeating: 0, count: 12) // Default IV value
9
+ if iv.isEmpty {
10
+ iv = AES.randomIV(12) // Generate a random IV if not provided or if empty
11
+ }
12
+
13
+ let gcm = GCM(iv: iv, mode: .combined)
14
+ let aes = try AES(key: secretKey, blockMode: gcm, padding: .noPadding)
15
+
16
+ let encrypted = try aes.encrypt(message)
17
+ let encryptedDataWithIv = Data(iv + encrypted) // Prepend IV to the encrypted data
18
+ return encryptedDataWithIv.base64EncodedString()
19
+ }
20
+
21
+ // AES/GCM Decryption with IV extracted from the beginning of the cipherText
22
+ public static func decryptMsg(_ cipherText: String, _ secretKey: [UInt8]) throws -> [UInt8] {
23
+ guard let encryptedDataWithIv = Data(base64Encoded: cipherText) else {
24
+ throw NSError(domain: "DecryptionError", code: -1, userInfo: nil)
25
+ }
26
+ let iv = Array(encryptedDataWithIv.prefix(12)) // Extract IV (first 12 bytes)
27
+ let encryptedData = Array(encryptedDataWithIv.dropFirst(12)) // The rest is the encrypted data
28
+
29
+ let gcm = GCM(iv: iv, mode: .combined)
30
+ let aes = try AES(key: secretKey, blockMode: gcm, padding: .noPadding)
31
+
32
+ let decrypted = try aes.decrypt(encryptedData)
33
+ return decrypted
34
+ }
35
+
36
+ // Key Generation matching Java's logic
37
+ public static func generateKey(_ identity: Data) throws -> Data {
38
+ // Transform identity to base64 string to mimic Java's behavior
39
+ let passwordString = identity.base64EncodedString()
40
+ let passwordData = Array(passwordString.utf8) // Convert to byte array
41
+
42
+ // Use identity itself as salt for simplicity to mimic Java behavior
43
+ let salt = Array(identity)
44
+
45
+ do {
46
+ let key = try PKCS5.PBKDF2(
47
+ password: passwordData,
48
+ salt: salt,
49
+ iterations: 1000, // Adjust the iteration count as needed
50
+ keyLength: 16, // AES-128
51
+ variant: .sha256
52
+ ).calculate()
53
+
54
+ return Data(key)
55
+ } catch {
56
+ throw error // Propagate error
57
+ }
58
+ }
59
+ }
@@ -1,3 +1,3 @@
1
- #import <React/RCTBridgeModule.h>
2
- #import <React/RCTViewManager.h>
3
- #import <React/RCTConvert.h>
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTViewManager.h>
3
+ #import <React/RCTConvert.h>