@novastera-oss/nitro-metamask 0.5.5 → 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 +19 -0
- package/android/build.gradle +6 -0
- 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
|
@@ -49,6 +49,25 @@ Add this inside your `MainActivity` `<activity>` tag:
|
|
|
49
49
|
- Ensure `android:launchMode="singleTask"` is set on your MainActivity (recommended for deep linking)
|
|
50
50
|
- This allows MetaMask to return to your app after the user approves the connection or signature
|
|
51
51
|
|
|
52
|
+
### Android 16 KB Compatibility
|
|
53
|
+
|
|
54
|
+
No extra Android configuration is required for consumers of this package.
|
|
55
|
+
|
|
56
|
+
- `@novastera-oss/nitro-metamask` excludes the legacy `io.metamask.ecies:ecies` native library from transitive dependencies.
|
|
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`.
|
|
61
|
+
- CI verifies 16 KB ELF LOAD alignment for release native libraries before publish.
|
|
62
|
+
|
|
63
|
+
For app developers, the expected upgrade path is:
|
|
64
|
+
|
|
65
|
+
1. Update to the new npm version.
|
|
66
|
+
2. Clean install + clean Android build.
|
|
67
|
+
3. Rebuild release AAB/APK.
|
|
68
|
+
|
|
69
|
+
No manual Gradle dependency override should be needed in the consuming app.
|
|
70
|
+
|
|
52
71
|
### iOS Configuration
|
|
53
72
|
|
|
54
73
|
**For Expo projects:** The package includes an Expo config plugin that automatically adds the required AppDelegate code. Just add the plugin to your `app.json` or `app.config.js`:
|
package/android/build.gradle
CHANGED
|
@@ -133,6 +133,12 @@ repositories {
|
|
|
133
133
|
google()
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
// Hard block old prebuilt ECIES .so from any transitive edge.
|
|
137
|
+
// NitroMetamask always provides libecies.so from rust/ecies-jni (16 KB page-size compatible).
|
|
138
|
+
configurations.configureEach {
|
|
139
|
+
exclude group: "io.metamask.ecies", module: "ecies"
|
|
140
|
+
}
|
|
141
|
+
|
|
136
142
|
|
|
137
143
|
dependencies {
|
|
138
144
|
// For < 0.71, this will be from the local maven repo
|
|
@@ -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",
|