Point NdrFfi provenance at protocol FFI

This commit is contained in:
Dev 2026-06-04 03:56:28 +03:00
parent d8b0ea307a
commit 6893c8377d
5 changed files with 13 additions and 12 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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"

View File

@ -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`

View File

@ -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"