@qntx/nostr-native 0.15.1 → 0.15.3

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.
@@ -16,6 +16,9 @@ Pod::Spec.new do |s|
16
16
  s.source_files = [
17
17
  # Implementation (C core + C++ HybridObject)
18
18
  "cpp/**/*.{h,hpp,c,cpp}",
19
+ # The public C ABI — consumers resolve "nostr_native.h" through the pod's
20
+ # public headers; it is the only header exported to dependents.
21
+ "include/**/*.h",
19
22
  # Vendored libsecp256k1: headers plus the two precomputed-table TUs. secp256k1.c is
20
23
  # intentionally not here — cpp/nostr_core.c includes it as a single translation unit.
21
24
  "vendor/secp256k1/include/**/*.h",
@@ -24,6 +27,8 @@ Pod::Spec.new do |s|
24
27
  "vendor/secp256k1/src/precomputed_ecmult_gen.c",
25
28
  ]
26
29
 
30
+ s.public_header_files = "include/nostr_native.h"
31
+
27
32
  s.pod_target_xcconfig = {
28
33
  "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) ENABLE_MODULE_ECDH=1 ENABLE_MODULE_EXTRAKEYS=1 ENABLE_MODULE_SCHNORRSIG=1",
29
34
  }
@@ -26,6 +26,7 @@ include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NostrNative+autolinkin
26
26
 
27
27
  include_directories(
28
28
  "../cpp"
29
+ "../include"
29
30
  "../vendor/secp256k1/include"
30
31
  )
31
32
 
@@ -20,6 +20,7 @@ def isNewArchitectureEnabled() {
20
20
  apply plugin: "com.android.library"
21
21
  apply plugin: 'org.jetbrains.kotlin.android'
22
22
  apply from: '../nitrogen/generated/android/NostrNative+autolinking.gradle'
23
+ apply from: './fix-prefab.gradle'
23
24
 
24
25
  if (isNewArchitectureEnabled()) {
25
26
  apply plugin: "com.facebook.react"
@@ -90,7 +91,16 @@ android {
90
91
 
91
92
  buildFeatures {
92
93
  buildConfig = true
94
+ // Consumes dependency prefabs (fbjni/ReactAndroid/Nitro) and publishes the
95
+ // built library itself so sibling packages can find_package(NostrNative).
93
96
  prefab = true
97
+ prefabPublishing = true
98
+ }
99
+
100
+ prefab {
101
+ NostrNative {
102
+ headers "../include"
103
+ }
94
104
  }
95
105
 
96
106
  buildTypes {
@@ -0,0 +1,57 @@
1
+ // Fixes the AGP ordering problem where prefab<Variant>ConfigurePackage runs before
2
+ // externalNativeBuild<Variant>, publishing a header-only (INTERFACE) package and
3
+ // leaving consumers' cached prefab_config.json stale. Ported from
4
+ // react-native-nitro-modules' android/fix-prefab.gradle (MIT):
5
+ // https://github.com/mrousavy/nitro/blob/main/packages/react-native-nitro-modules/android/fix-prefab.gradle
6
+
7
+ tasks.configureEach { task ->
8
+ // Make sure that we generate our prefab publication file only after having built the native library
9
+ // so that not a header publication file, but a full configuration publication will be generated, which
10
+ // will include the .so file
11
+
12
+ def prefabConfigurePattern = ~/^prefab(.+)ConfigurePackage$/
13
+ def matcher = task.name =~ prefabConfigurePattern
14
+ if (matcher.matches()) {
15
+ def variantName = matcher[0][1]
16
+ task.outputs.upToDateWhen { false }
17
+ task.dependsOn("externalNativeBuild${variantName}")
18
+ }
19
+ }
20
+
21
+ afterEvaluate {
22
+ def abis = reactNativeArchitectures()
23
+ rootProject.allprojects.each { proj ->
24
+ if (proj === rootProject) return
25
+
26
+ def dependsOnThisLib = proj.configurations.findAll { it.canBeResolved }.any { config ->
27
+ config.dependencies.any { dep ->
28
+ dep.group == project.group && dep.name == project.name
29
+ }
30
+ }
31
+ if (!dependsOnThisLib && proj != project) return
32
+
33
+ if (!proj.plugins.hasPlugin('com.android.application') && !proj.plugins.hasPlugin('com.android.library')) {
34
+ return
35
+ }
36
+
37
+ def variants = proj.android.hasProperty('applicationVariants') ? proj.android.applicationVariants : proj.android.libraryVariants
38
+ // Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to
39
+ // generate a libnameConfig.cmake file that will contain our native library (.so).
40
+ // See this condition: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ExternalNativeJsonGenerator.kt;l=207-219?q=createPrefabBuildSystemGlue
41
+ variants.all { variant ->
42
+ def variantName = variant.name
43
+ abis.each { abi ->
44
+ def searchDir = new File(proj.projectDir, ".cxx/${variantName}")
45
+ if (!searchDir.exists()) return
46
+ def matches = []
47
+ searchDir.eachDir { randomDir ->
48
+ def prefabFile = new File(randomDir, "${abi}/prefab_config.json")
49
+ if (prefabFile.exists()) matches << prefabFile
50
+ }
51
+ matches.each { prefabConfig ->
52
+ prefabConfig.setLastModified(System.currentTimeMillis())
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qntx/nostr-native",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "Native libsecp256k1 (Nitro) verification and signing backend for @qntx/nostr on React Native",
5
5
  "keywords": [
6
6
  "bip340",
@@ -23,7 +23,9 @@
23
23
  "files": [
24
24
  "dist",
25
25
  "cpp",
26
+ "include",
26
27
  "android/build.gradle",
28
+ "android/fix-prefab.gradle",
27
29
  "android/CMakeLists.txt",
28
30
  "android/gradle.properties",
29
31
  "android/src",
@@ -61,7 +63,7 @@
61
63
  "@arethetypeswrong/cli": "0.18.5",
62
64
  "@noble/curves": "2.4.0",
63
65
  "@noble/hashes": "2.4.0",
64
- "@qntx/nostr": "0.15.1",
66
+ "@qntx/nostr": "0.15.3",
65
67
  "@qntx/tsconfig": "1.0.1",
66
68
  "@types/node": "26.6.5",
67
69
  "nitrogen": "0.37.1",
@@ -71,7 +73,7 @@
71
73
  "vite-plus": "1.3.0"
72
74
  },
73
75
  "peerDependencies": {
74
- "@qntx/nostr": "^0.15.1",
76
+ "@qntx/nostr": "^0.15.3",
75
77
  "react-native": "*",
76
78
  "react-native-nitro-modules": "^0.37.1"
77
79
  },
File without changes