@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.
- package/LICENSE +20 -20
- package/android/build.gradle +114 -114
- package/android/gradle.properties +8 -8
- package/android/src/main/AndroidManifest.xml +3 -3
- package/android/src/main/AndroidManifestNew.xml +2 -2
- package/android/src/main/java/land/fx/fula/ConfigRef.java +7 -7
- package/android/src/main/java/land/fx/fula/Cryptography.java +62 -62
- package/android/src/main/java/land/fx/fula/FulaModule.java +0 -0
- package/android/src/main/java/land/fx/fula/FulaPackage.java +32 -32
- package/android/src/main/java/land/fx/fula/SharedPreferenceHelper.java +65 -65
- package/android/src/main/java/land/fx/fula/StaticHelper.java +13 -13
- package/android/src/main/java/land/fx/fula/ThreadUtils.java +42 -42
- package/ios/Cryptography.swift +59 -59
- package/ios/Fula-Bridging-Header.h +3 -3
- package/ios/Fula.mm +272 -272
- package/ios/Fula.swift +32 -21
- package/ios/UserDataHelper.swift +143 -143
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-consts.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-errors.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-events.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-query.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-rpc.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-runtime.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-tx.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api.js.map +1 -1
- package/lib/commonjs/interfaces/augment-types.js.map +1 -1
- package/lib/commonjs/interfaces/definitions.js.map +1 -1
- package/lib/commonjs/interfaces/defintions.js.map +1 -1
- package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/commonjs/interfaces/index.js.map +1 -1
- package/lib/commonjs/interfaces/lookup.js +300 -300
- package/lib/commonjs/interfaces/lookup.js.map +1 -1
- package/lib/commonjs/interfaces/registry.js.map +1 -1
- package/lib/commonjs/interfaces/types-lookup.js.map +1 -1
- package/lib/commonjs/interfaces/types.js.map +1 -1
- package/lib/commonjs/protocols/blockchain.js +70 -70
- package/lib/commonjs/protocols/blockchain.js.map +1 -1
- package/lib/commonjs/protocols/chain-api.js.map +1 -1
- package/lib/commonjs/protocols/fula.js.map +1 -1
- package/lib/commonjs/protocols/fx-ai.js.map +1 -1
- package/lib/commonjs/protocols/fxblox.js +3 -3
- package/lib/commonjs/protocols/fxblox.js.map +1 -1
- package/lib/commonjs/types/blockchain.js.map +1 -1
- package/lib/commonjs/types/fxblox.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/augment-api-consts.js.map +1 -1
- package/lib/module/interfaces/augment-api-errors.js.map +1 -1
- package/lib/module/interfaces/augment-api-events.js.map +1 -1
- package/lib/module/interfaces/augment-api-query.js.map +1 -1
- package/lib/module/interfaces/augment-api-rpc.js.map +1 -1
- package/lib/module/interfaces/augment-api-runtime.js.map +1 -1
- package/lib/module/interfaces/augment-api-tx.js.map +1 -1
- package/lib/module/interfaces/augment-api.js.map +1 -1
- package/lib/module/interfaces/augment-types.js.map +1 -1
- package/lib/module/interfaces/definitions.js.map +1 -1
- package/lib/module/interfaces/defintions.js.map +1 -1
- package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/module/interfaces/index.js.map +1 -1
- package/lib/module/interfaces/lookup.js +300 -300
- package/lib/module/interfaces/lookup.js.map +1 -1
- package/lib/module/interfaces/registry.js.map +1 -1
- package/lib/module/interfaces/types-lookup.js.map +1 -1
- package/lib/module/interfaces/types.js.map +1 -1
- package/lib/module/protocols/blockchain.js +70 -70
- package/lib/module/protocols/blockchain.js.map +1 -1
- package/lib/module/protocols/chain-api.js.map +1 -1
- package/lib/module/protocols/fula.js.map +1 -1
- package/lib/module/protocols/fx-ai.js.map +1 -1
- package/lib/module/protocols/fxblox.js +3 -3
- package/lib/module/protocols/fxblox.js.map +1 -1
- package/lib/module/types/blockchain.js.map +1 -1
- package/lib/module/types/fxblox.js.map +1 -1
- package/package.json +177 -176
- package/src/index.tsx +4 -4
- package/src/interfaces/augment-api-consts.ts +273 -273
- package/src/interfaces/augment-api-errors.ts +474 -474
- package/src/interfaces/augment-api-events.ts +448 -448
- package/src/interfaces/augment-api-query.ts +466 -466
- package/src/interfaces/augment-api-rpc.ts +617 -617
- package/src/interfaces/augment-api-runtime.ts +223 -223
- package/src/interfaces/augment-api-tx.ts +709 -709
- package/src/interfaces/augment-api.ts +9 -9
- package/src/interfaces/augment-types.ts +1322 -1322
- package/src/interfaces/definitions.ts +1 -1
- package/src/interfaces/defintions.ts +1 -1
- package/src/interfaces/index.ts +3 -3
- package/src/interfaces/lookup.ts +2011 -2011
- package/src/interfaces/registry.ts +163 -163
- package/src/interfaces/types-lookup.ts +2165 -2165
- package/src/interfaces/types.ts +2 -2
- package/src/protocols/blockchain.ts +716 -716
- 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
|
+
}
|
package/ios/Cryptography.swift
CHANGED
|
@@ -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>
|