Skip to content

Latest commit

 

History

History

nostr-sdk-ffi

Nostr SDK FFI

Prerequisites

  • Rust: https://www.rust-lang.org/tools/install
  • Just: https://just.systems/man/en/ (install with cargo install just)
  • When building for Android:
    • NDK v26
    • Set the ANDROID_SDK_ROOT env variable (ex. Linux: ~/Android/Sdk, macOS: ~/Library/Android/sdk)
    • Set the ANDROID_NDK_HOME env variable (ex. Linux: ~/Android/Sdk/ndk/<version>, macOS: ~/Library/Android/sdk/ndk/<version>)

Build

On first usage you will need to run:

just init

Python

For most users, we recommend using our official Python package: nostr-sdk.

If you want to compile from source or need more options, read on.

Wheel

just python

Kotlin

For most users, we recommend using our official Kotlin package: org.rust-nostr:nostr-sdk.

If you want to compile from source or need more options, read on.

Libraries and Bindings

This command will build libraries for different platforms in target/ folder and copy them to ffi/kotlin/jniLibs. In addition it will generate Kotlin bindings in ffi/kotlin/nostr_sdk.

just kotlin

Android Archive (AAR)

This command will build an AAR file in ffi/android/lib-release.aar:

just bindings-android

See Add your AAR or JAR as a dependency in Android's docs for more information on how to integrate such an archive into your project.

Swift

For most users, we recommend using our official Swift package: rust-nostr/nostr-sdk-swift.

If you want to compile from source or need more options, read on.

Swift Module

These commands will build libraries for different architectures in ../../target/ and generate Swift bindings as well as Swift module artifacts in ffi/swift-ios/ and ffi/swift-darwin/ respectively:

just swift-ios
just swift-darwin

Swift Package

This command will produce a fully configured Swift Package in bindings-swift/. See Adding package dependencies to your app in Apple's docs for more information on how to integrate such a package into your project.

just bindings-swift

License

This project is distributed under the MIT software license - see the LICENSE file for details