From 6893c8377dd2969e468c95953c6b801ee441a7e4 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 4 Jun 2026 03:56:28 +0300 Subject: [PATCH] Point NdrFfi provenance at protocol FFI --- bitchat/Services/NdrNostrService.swift | 2 +- .../Extensions/ChatViewModel+Nostr.swift | 2 +- localPackages/NdrFfi/Package.swift | 2 +- localPackages/NdrFfi/README.md | 17 +++++++++-------- localPackages/NdrFfi/build-apple.sh | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bitchat/Services/NdrNostrService.swift b/bitchat/Services/NdrNostrService.swift index 3b6c2635..12500804 100644 --- a/bitchat/Services/NdrNostrService.swift +++ b/bitchat/Services/NdrNostrService.swift @@ -17,7 +17,7 @@ protocol NostrRelayManaging: AnyObject { extension NostrRelayManager: NostrRelayManaging {} -/// Bridges `nostr-double-ratchet` (ndr-ffi) `SessionManagerHandle` with `NostrRelayManager`. +/// Bridges the protocol-backed `NdrFfi` `SessionManagerHandle` with `NostrRelayManager`. /// /// The ndr session manager emits a stream of pub/sub actions we must execute externally: /// - `subscribe` / `unsubscribe`: Nostr filter subscriptions (for invite responses, sessions, etc) diff --git a/bitchat/ViewModels/Extensions/ChatViewModel+Nostr.swift b/bitchat/ViewModels/Extensions/ChatViewModel+Nostr.swift index 3ce81844..b3104d61 100644 --- a/bitchat/ViewModels/Extensions/ChatViewModel+Nostr.swift +++ b/bitchat/ViewModels/Extensions/ChatViewModel+Nostr.swift @@ -582,7 +582,7 @@ extension ChatViewModel { SecureLogger.debug("🔑 Setting up Nostr subscription for pubkey: \(currentIdentity.publicKeyHex.prefix(16))...", category: .session) - // Configure nostr-double-ratchet (ndr-ffi) integration. + // Configure protocol-backed NdrFfi integration. // BitChat policy: invite/response handshake is exchanged out-of-band over BLE (mutual favorites), // so we only use Nostr here for kind 1060 message exchange and decryption. ndrService.configureIfNeeded(identity: currentIdentity) diff --git a/localPackages/NdrFfi/Package.swift b/localPackages/NdrFfi/Package.swift index 2eac5ed1..a7aa6d47 100644 --- a/localPackages/NdrFfi/Package.swift +++ b/localPackages/NdrFfi/Package.swift @@ -21,7 +21,7 @@ let package = Package( dependencies: ["ndr_ffiFFI"], path: "Sources/NdrFfi" ), - // Binary xcframework built from the ndr-ffi Rust crate + // Binary xcframework built from iris-chat-rs protocol-ffi .binaryTarget( name: "ndr_ffiFFI", path: "Frameworks/NdrFfi.xcframework" diff --git a/localPackages/NdrFfi/README.md b/localPackages/NdrFfi/README.md index b8925e5f..b9978ba0 100644 --- a/localPackages/NdrFfi/README.md +++ b/localPackages/NdrFfi/README.md @@ -1,13 +1,14 @@ # NdrFfi Vendored Swift bindings and Apple XCFramework for the upstream -`nostr-double-ratchet` `ndr-ffi` crate. +`iris-chat-rs` `protocol-ffi` crate. ## Source Of Truth The generated files in this package come from the upstream -`nostr-double-ratchet` checkout, specifically the Rust `ndr-ffi` crate and its -UniFFI-generated Swift bindings. +`iris-chat-rs` checkout, specifically the Rust `protocol-ffi` crate and its +UniFFI-generated Swift bindings. The built library keeps the compatibility +name `ndr_ffi`. The exact upstream revision used for the currently vendored artifacts is recorded in `VENDORED_FROM.md`. @@ -15,11 +16,11 @@ recorded in `VENDORED_FROM.md`. Default expected upstream checkout: ```bash -$HOME/src/nostr-double-ratchet +$HOME/src/iris-chat-rs ``` You can also point the build at a different checkout by passing a path or by -setting `NDR_SOURCE_DIR`. +setting `ICP_SOURCE_DIR`. ## Rebuild From Source @@ -37,19 +38,19 @@ Example: ```bash rustup target add aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim cd localPackages/NdrFfi -./build-apple.sh ~/src/nostr-double-ratchet +./build-apple.sh ~/src/iris-chat-rs ``` Or: ```bash cd localPackages/NdrFfi -NDR_SOURCE_DIR=/path/to/nostr-double-ratchet ./build-apple.sh +ICP_SOURCE_DIR=/path/to/iris-chat-rs ./build-apple.sh ``` The script: -- builds the upstream `ndr-ffi` crate +- builds the upstream `protocol-ffi` crate - regenerates `Sources/NdrFfi/NdrFfi.swift` via UniFFI - rebuilds the Apple XCFramework at `Frameworks/NdrFfi.xcframework` - bakes in the current Apple deployment targets used by `bitchat` diff --git a/localPackages/NdrFfi/build-apple.sh b/localPackages/NdrFfi/build-apple.sh index e6f16f58..fea735a0 100755 --- a/localPackages/NdrFfi/build-apple.sh +++ b/localPackages/NdrFfi/build-apple.sh @@ -3,7 +3,7 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PACKAGE_DIR="$SCRIPT_DIR" -SOURCE_DIR="${1:-${NDR_SOURCE_DIR:-${ICP_SOURCE_DIR:-$HOME/src/iris-chat-rs}}}" +SOURCE_DIR="${1:-${ICP_SOURCE_DIR:-$HOME/src/iris-chat-rs}}" CRATE_DIR="$SOURCE_DIR/protocol-ffi" CRATE_MANIFEST="$CRATE_DIR/Cargo.toml" BINDGEN_MANIFEST="$SOURCE_DIR/core/uniffi-bindgen/Cargo.toml"