@novastera-oss/nitro-metamask 0.5.6 → 0.6.2
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/README.md +4 -1
- package/android/cargo-ecies.gradle +64 -4
- package/android/src/main/jniLibs/arm64-v8a/libecies.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libecies.so +0 -0
- package/android/src/main/jniLibs/x86/libecies.so +0 -0
- package/android/src/main/jniLibs/x86_64/libecies.so +0 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -54,7 +54,10 @@ Add this inside your `MainActivity` `<activity>` tag:
|
|
|
54
54
|
No extra Android configuration is required for consumers of this package.
|
|
55
55
|
|
|
56
56
|
- `@novastera-oss/nitro-metamask` excludes the legacy `io.metamask.ecies:ecies` native library from transitive dependencies.
|
|
57
|
-
- The package
|
|
57
|
+
- The package ships prebuilt `libecies.so` binaries per ABI under `android/src/main/jniLibs`.
|
|
58
|
+
- Included ABIs: `arm64-v8a`, `armeabi-v7a`, `x86_64`, `x86`.
|
|
59
|
+
- Consumers do **not** need Rust or Cargo installed.
|
|
60
|
+
- Maintainers can rebuild ECIES from source with `-PNitroMetamask_buildEciesFromSource=true`.
|
|
58
61
|
- CI verifies 16 KB ELF LOAD alignment for release native libraries before publish.
|
|
59
62
|
|
|
60
63
|
For app developers, the expected upgrade path is:
|
|
@@ -1,17 +1,67 @@
|
|
|
1
1
|
def eciesRustDir = file("${projectDir}/../rust/ecies-jni")
|
|
2
2
|
def eciesCargoToml = file("${projectDir}/../rust/ecies-jni/Cargo.toml")
|
|
3
3
|
def eciesJniOut = file("${buildDir}/intermediates/rust-ecies-jni")
|
|
4
|
+
def eciesPrebuiltDir = file("${projectDir}/src/main/jniLibs")
|
|
5
|
+
def buildEciesFromSource = (project.findProperty("NitroMetamask_buildEciesFromSource") ?: "false").toString().toBoolean()
|
|
4
6
|
|
|
5
7
|
def reactNativeArchitectures() {
|
|
6
8
|
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
7
9
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
def hasCargoExecutable = { ->
|
|
13
|
+
def path = System.getenv("PATH") ?: ""
|
|
14
|
+
if (path.isEmpty()) {
|
|
15
|
+
return false
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def names = ["cargo"]
|
|
19
|
+
def isWindows = (System.getProperty("os.name") ?: "").toLowerCase().contains("win")
|
|
20
|
+
if (isWindows) {
|
|
21
|
+
names = ["cargo.exe", "cargo.bat", "cargo.cmd"]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (dirPath in path.split(java.io.File.pathSeparator)) {
|
|
25
|
+
for (name in names) {
|
|
26
|
+
def candidate = new File(dirPath, name)
|
|
27
|
+
if (candidate.isFile() && candidate.canExecute()) {
|
|
28
|
+
return true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
tasks.register("verifyPrebuiltEciesLibs") {
|
|
37
|
+
group = "verification"
|
|
38
|
+
description = "Verify prebuilt libecies.so exists for all configured ABIs"
|
|
39
|
+
|
|
40
|
+
doLast {
|
|
41
|
+
def missing = []
|
|
42
|
+
reactNativeArchitectures().each { abi ->
|
|
43
|
+
def soFile = file("${eciesPrebuiltDir}/${abi}/libecies.so")
|
|
44
|
+
if (!soFile.isFile()) {
|
|
45
|
+
missing.add("${abi}/libecies.so")
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!missing.isEmpty()) {
|
|
50
|
+
throw new GradleException(
|
|
51
|
+
"Missing prebuilt ECIES native libraries under android/src/main/jniLibs: ${missing.join(', ')}. " +
|
|
52
|
+
"Consumers should use prebuilt libs (no Cargo required). " +
|
|
53
|
+
"Maintainers can regenerate with -PNitroMetamask_buildEciesFromSource=true."
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
10
59
|
tasks.register("cargoNdkBuildEcies", Exec) {
|
|
11
60
|
group = "build"
|
|
12
|
-
description = "Build libecies.so via Rust (
|
|
61
|
+
description = "Build libecies.so via Rust (maintainer-only)"
|
|
62
|
+
enabled = buildEciesFromSource
|
|
13
63
|
onlyIf {
|
|
14
|
-
eciesRustDir.isDirectory() && eciesCargoToml.isFile()
|
|
64
|
+
buildEciesFromSource && eciesRustDir.isDirectory() && eciesCargoToml.isFile()
|
|
15
65
|
}
|
|
16
66
|
workingDir eciesRustDir
|
|
17
67
|
standardOutput System.out
|
|
@@ -28,9 +78,15 @@ afterEvaluate {
|
|
|
28
78
|
def ndkVer = project.android.ndkVersion
|
|
29
79
|
def abis = reactNativeArchitectures()
|
|
30
80
|
def outPath = eciesJniOut.absolutePath
|
|
31
|
-
|
|
32
81
|
tasks.named("cargoNdkBuildEcies", Exec).configure {
|
|
33
82
|
doFirst {
|
|
83
|
+
if (!hasCargoExecutable()) {
|
|
84
|
+
throw new GradleException(
|
|
85
|
+
"Cargo is not available. This build mode is maintainer-only. " +
|
|
86
|
+
"Run without -PNitroMetamask_buildEciesFromSource to use bundled prebuilt libraries."
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
34
90
|
eciesJniOut.mkdirs()
|
|
35
91
|
if (!ndkDir.exists()) {
|
|
36
92
|
throw new GradleException("ANDROID NDK not found; ndkVersion is ${ndkVer}")
|
|
@@ -49,6 +105,10 @@ afterEvaluate {
|
|
|
49
105
|
}
|
|
50
106
|
|
|
51
107
|
tasks.matching { it.name.startsWith("preBuild") }.configureEach {
|
|
52
|
-
|
|
108
|
+
if (buildEciesFromSource) {
|
|
109
|
+
dependsOn("cargoNdkBuildEcies")
|
|
110
|
+
} else {
|
|
111
|
+
dependsOn("verifyPrebuiltEciesLibs")
|
|
112
|
+
}
|
|
53
113
|
}
|
|
54
114
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novastera-oss/nitro-metamask",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Native mobile MetaMask wallet integration for React Native. Part of Novastera CRM/ERP platform ecosystem. Provides secure authentication and message signing for Web3 mobile applications.",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"clean": "git clean -dfX",
|
|
13
13
|
"release": "semantic-release",
|
|
14
14
|
"build": "npm run typecheck && bob build",
|
|
15
|
-
"codegen": "nitrogen --logLevel=\"debug\" && npm run build"
|
|
15
|
+
"codegen": "nitrogen --logLevel=\"debug\" && npm run build",
|
|
16
|
+
"build:ecies:all-abis": "cd example/android && ./gradlew :app:assembleRelease -PreactNativeArchitectures=arm64-v8a,armeabi-v7a,x86_64,x86 -PNitroMetamask_buildEciesFromSource=true --no-daemon --stacktrace"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
18
19
|
"react-native",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"android/CMakeLists.txt",
|
|
48
49
|
"android/proguard-rules.pro",
|
|
49
50
|
"android/src",
|
|
51
|
+
"android/src/main/jniLibs",
|
|
50
52
|
"ios/**/*.h",
|
|
51
53
|
"ios/**/*.m",
|
|
52
54
|
"ios/**/*.mm",
|