@functionland/react-native-fula 1.55.15 → 1.55.17

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 (93) 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 +0 -0
  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 -272
  16. package/ios/Fula.swift +32 -21
  17. package/ios/UserDataHelper.swift +143 -143
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/interfaces/augment-api-consts.js.map +1 -1
  20. package/lib/commonjs/interfaces/augment-api-errors.js.map +1 -1
  21. package/lib/commonjs/interfaces/augment-api-events.js.map +1 -1
  22. package/lib/commonjs/interfaces/augment-api-query.js.map +1 -1
  23. package/lib/commonjs/interfaces/augment-api-rpc.js.map +1 -1
  24. package/lib/commonjs/interfaces/augment-api-runtime.js.map +1 -1
  25. package/lib/commonjs/interfaces/augment-api-tx.js.map +1 -1
  26. package/lib/commonjs/interfaces/augment-api.js.map +1 -1
  27. package/lib/commonjs/interfaces/augment-types.js.map +1 -1
  28. package/lib/commonjs/interfaces/definitions.js.map +1 -1
  29. package/lib/commonjs/interfaces/defintions.js.map +1 -1
  30. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  31. package/lib/commonjs/interfaces/index.js.map +1 -1
  32. package/lib/commonjs/interfaces/lookup.js +300 -300
  33. package/lib/commonjs/interfaces/lookup.js.map +1 -1
  34. package/lib/commonjs/interfaces/registry.js.map +1 -1
  35. package/lib/commonjs/interfaces/types-lookup.js.map +1 -1
  36. package/lib/commonjs/interfaces/types.js.map +1 -1
  37. package/lib/commonjs/protocols/blockchain.js +70 -70
  38. package/lib/commonjs/protocols/blockchain.js.map +1 -1
  39. package/lib/commonjs/protocols/chain-api.js.map +1 -1
  40. package/lib/commonjs/protocols/fula.js.map +1 -1
  41. package/lib/commonjs/protocols/fx-ai.js.map +1 -1
  42. package/lib/commonjs/protocols/fxblox.js +3 -3
  43. package/lib/commonjs/protocols/fxblox.js.map +1 -1
  44. package/lib/commonjs/types/blockchain.js.map +1 -1
  45. package/lib/commonjs/types/fxblox.js.map +1 -1
  46. package/lib/module/index.js.map +1 -1
  47. package/lib/module/interfaces/augment-api-consts.js.map +1 -1
  48. package/lib/module/interfaces/augment-api-errors.js.map +1 -1
  49. package/lib/module/interfaces/augment-api-events.js.map +1 -1
  50. package/lib/module/interfaces/augment-api-query.js.map +1 -1
  51. package/lib/module/interfaces/augment-api-rpc.js.map +1 -1
  52. package/lib/module/interfaces/augment-api-runtime.js.map +1 -1
  53. package/lib/module/interfaces/augment-api-tx.js.map +1 -1
  54. package/lib/module/interfaces/augment-api.js.map +1 -1
  55. package/lib/module/interfaces/augment-types.js.map +1 -1
  56. package/lib/module/interfaces/definitions.js.map +1 -1
  57. package/lib/module/interfaces/defintions.js.map +1 -1
  58. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  59. package/lib/module/interfaces/index.js.map +1 -1
  60. package/lib/module/interfaces/lookup.js +300 -300
  61. package/lib/module/interfaces/lookup.js.map +1 -1
  62. package/lib/module/interfaces/registry.js.map +1 -1
  63. package/lib/module/interfaces/types-lookup.js.map +1 -1
  64. package/lib/module/interfaces/types.js.map +1 -1
  65. package/lib/module/protocols/blockchain.js +70 -70
  66. package/lib/module/protocols/blockchain.js.map +1 -1
  67. package/lib/module/protocols/chain-api.js.map +1 -1
  68. package/lib/module/protocols/fula.js.map +1 -1
  69. package/lib/module/protocols/fx-ai.js.map +1 -1
  70. package/lib/module/protocols/fxblox.js +3 -3
  71. package/lib/module/protocols/fxblox.js.map +1 -1
  72. package/lib/module/types/blockchain.js.map +1 -1
  73. package/lib/module/types/fxblox.js.map +1 -1
  74. package/package.json +177 -176
  75. package/src/index.tsx +4 -4
  76. package/src/interfaces/augment-api-consts.ts +273 -273
  77. package/src/interfaces/augment-api-errors.ts +474 -474
  78. package/src/interfaces/augment-api-events.ts +448 -448
  79. package/src/interfaces/augment-api-query.ts +466 -466
  80. package/src/interfaces/augment-api-rpc.ts +617 -617
  81. package/src/interfaces/augment-api-runtime.ts +223 -223
  82. package/src/interfaces/augment-api-tx.ts +709 -709
  83. package/src/interfaces/augment-api.ts +9 -9
  84. package/src/interfaces/augment-types.ts +1322 -1322
  85. package/src/interfaces/definitions.ts +1 -1
  86. package/src/interfaces/defintions.ts +1 -1
  87. package/src/interfaces/index.ts +3 -3
  88. package/src/interfaces/lookup.ts +2011 -2011
  89. package/src/interfaces/registry.ts +163 -163
  90. package/src/interfaces/types-lookup.ts +2165 -2165
  91. package/src/interfaces/types.ts +2 -2
  92. package/src/protocols/blockchain.ts +716 -716
  93. package/src/protocols/fxblox.ts +442 -442
@@ -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>