Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions NostrSdkReactNative.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Generated by uniffi-bindgen-react-native
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|
s.name = "NostrSdkReactNative"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]

s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/rust-nostr/nostr-sdk-react-native.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,swift}", "ios/generated/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}", "cpp/generated/**/*.{hpp,cpp,c,h}"
s.vendored_frameworks = "RustNostrNostrSdkReactNativeFramework.xcframework"
s.dependency "uniffi-bindgen-react-native", "0.29.3-1"

# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
if respond_to?(:install_modules_dependencies, true)
install_modules_dependencies(s)
else
s.dependency "React-Core"

# Don't install the dependencies when we run `pod install` in the old architecture.
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}
s.dependency "React-Codegen"
s.dependency "RCT-Folly"
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
end
end
end
1 change: 0 additions & 1 deletion deps/nostr-sdk-ffi
Submodule nostr-sdk-ffi deleted from 5cbe03
64 changes: 32 additions & 32 deletions example/ios/NostrSdkReactNativeExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
objects = {

/* Begin PBXBuildFile section */
0C80B921A6F3F58F76C31292 /* libPods-NostrSdkReactNativeExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-NostrSdkReactNativeExample.a */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
A1CB7695C9DB56E2D091DA6F /* libPods-NostrSdkReactNativeExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 883F849050BC703D9062EA34 /* libPods-NostrSdkReactNativeExample.a */; };
D97E4649F137287B38656E21 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
/* End PBXBuildFile section */

Expand All @@ -19,11 +19,11 @@
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = NostrSdkReactNativeExample/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = NostrSdkReactNativeExample/Info.plist; sourceTree = "<group>"; };
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = NostrSdkReactNativeExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3B4392A12AC88292D35C810B /* Pods-NostrSdkReactNativeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NostrSdkReactNativeExample.debug.xcconfig"; path = "Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample.debug.xcconfig"; sourceTree = "<group>"; };
5709B34CF0A7D63546082F79 /* Pods-NostrSdkReactNativeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NostrSdkReactNativeExample.release.xcconfig"; path = "Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample.release.xcconfig"; sourceTree = "<group>"; };
5DCACB8F33CDC322A6C60F78 /* libPods-NostrSdkReactNativeExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-NostrSdkReactNativeExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = NostrSdkReactNativeExample/AppDelegate.swift; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = NostrSdkReactNativeExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
883F849050BC703D9062EA34 /* libPods-NostrSdkReactNativeExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-NostrSdkReactNativeExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
AADDA3D7DD08EACA309D33D0 /* Pods-NostrSdkReactNativeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NostrSdkReactNativeExample.release.xcconfig"; path = "Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample.release.xcconfig"; sourceTree = "<group>"; };
C69BD6034458A365B461AE76 /* Pods-NostrSdkReactNativeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NostrSdkReactNativeExample.debug.xcconfig"; path = "Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample.debug.xcconfig"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand All @@ -32,7 +32,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0C80B921A6F3F58F76C31292 /* libPods-NostrSdkReactNativeExample.a in Frameworks */,
A1CB7695C9DB56E2D091DA6F /* libPods-NostrSdkReactNativeExample.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -55,7 +55,7 @@
isa = PBXGroup;
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
5DCACB8F33CDC322A6C60F78 /* libPods-NostrSdkReactNativeExample.a */,
883F849050BC703D9062EA34 /* libPods-NostrSdkReactNativeExample.a */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -92,8 +92,8 @@
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
isa = PBXGroup;
children = (
3B4392A12AC88292D35C810B /* Pods-NostrSdkReactNativeExample.debug.xcconfig */,
5709B34CF0A7D63546082F79 /* Pods-NostrSdkReactNativeExample.release.xcconfig */,
C69BD6034458A365B461AE76 /* Pods-NostrSdkReactNativeExample.debug.xcconfig */,
AADDA3D7DD08EACA309D33D0 /* Pods-NostrSdkReactNativeExample.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
Expand All @@ -105,13 +105,13 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "NostrSdkReactNativeExample" */;
buildPhases = (
C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */,
1AE9616C32CA2B8418786B2E /* [CP] Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,
08BEEF0669F0EAEED638413B /* [CP] Embed Pods Frameworks */,
05D05EC57FDFC94B57B351DE /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -183,7 +183,24 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
05D05EC57FDFC94B57B351DE /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
08BEEF0669F0EAEED638413B /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -200,7 +217,7 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {
1AE9616C32CA2B8418786B2E /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -222,23 +239,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NostrSdkReactNativeExample/Pods-NostrSdkReactNativeExample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -255,7 +255,7 @@
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-NostrSdkReactNativeExample.debug.xcconfig */;
baseConfigurationReference = C69BD6034458A365B461AE76 /* Pods-NostrSdkReactNativeExample.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -283,7 +283,7 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-NostrSdkReactNativeExample.release.xcconfig */;
baseConfigurationReference = AADDA3D7DD08EACA309D33D0 /* Pods-NostrSdkReactNativeExample.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
Expand Down
3 changes: 2 additions & 1 deletion example/ios/NostrSdkReactNativeExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<!-- Do not change NSAllowsArbitraryLoads to true, or you will risk app rejection! -->
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>RCTNewArchEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
14 changes: 7 additions & 7 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"build:ios": "react-native build-ios --scheme NostrSdkReactNativeExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\""
},
"dependencies": {
"react": "19.0.0",
"react-native": "0.78.1"
"react": "19.1.0",
"react-native": "0.81.3"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand All @@ -20,11 +20,11 @@
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.78.1",
"@react-native/metro-config": "0.78.1",
"@react-native/typescript-config": "0.78.1",
"@types/react": "^19.0.0",
"react-native-builder-bob": "^0.38.3"
"@react-native/babel-preset": "0.81.3",
"@react-native/metro-config": "0.81.3",
"@react-native/typescript-config": "0.81.3",
"@types/react": "^19.1.0",
"react-native-builder-bob": "^0.40"
},
"engines": {
"node": ">=18"
Expand Down
13 changes: 10 additions & 3 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import { Text, View, StyleSheet } from 'react-native';
import { useEffect, useState } from 'react';
import { Keys } from '../../src';

const keys = Keys.generate();

export default function App() {
const [publicKey, setPublicKey] = useState('');

useEffect(() => {
let keys = Keys.generate();
setPublicKey(keys.publicKey().toBech32());
}, []);

return (
<View style={styles.container}>
<Text>Result: {keys.publicKey().toBech32()}</Text>
<Text>Public Key: {publicKey}</Text>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
},
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
"eslint-plugin-prettier": "^5.2.3",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"react": "19.0.0",
"react-native": "0.78.1",
"react-native-builder-bob": "^0.38.3",
"react": "^19.0.0",
"react-native": "0.81.3",
"react-native-builder-bob": "^0.40",
"release-it": "^17.10.0",
"turbo": "^1.10.7",
"typescript": "^5.2.2"
Expand Down Expand Up @@ -178,9 +178,9 @@
"create-react-native-library": {
"type": "turbo-module",
"languages": "cpp",
"version": "0.49.0"
"version": "^0.49.0"
},
"dependencies": {
"uniffi-bindgen-react-native": "^0.28.3-5"
"uniffi-bindgen-react-native": "^0.29.3-1"
}
}
3 changes: 2 additions & 1 deletion ubrn.config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
rust:
directory: deps/nostr-sdk-ffi
repo: https://github.com/rust-nostr/nostr-sdk-ffi.git
branch: master
manifestPath: Cargo.toml
Loading
Loading