diff --git a/.github/actions/kotlin-bindings/action.yml b/.github/actions/kotlin-bindings/action.yml index 43276ac2e..998abc63a 100644 --- a/.github/actions/kotlin-bindings/action.yml +++ b/.github/actions/kotlin-bindings/action.yml @@ -1,8 +1,8 @@ name: Kotlin UniFFI bindings description: > - Generates the wallet and Nym proxy shim Kotlin bindings into + Generates the wallet and mixnet proxy Kotlin bindings into android/app/build/generated/source/uniffi//java with - scripts/generate_kotlin_bindings.mjs. Builds the shim for the host. + scripts/generate_kotlin_bindings.mjs. Builds the proxy for the host. inputs: variants: @@ -21,15 +21,15 @@ runs: shell: bash run: rustup default stable - - name: Cache the bindgen and shim builds + - name: Cache the bindgen and proxy builds uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git rust/target - rust/nym-proxy-ffi/target - key: kotlin-bindings-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock', 'rust/nym-proxy-ffi/Cargo.lock') }} + rust/mixnet-proxy/target + key: kotlin-bindings-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock', 'rust/mixnet-proxy/Cargo.lock') }} - name: Generate Kotlin bindings shell: bash diff --git a/.github/workflows/android-apk-build.yaml b/.github/workflows/android-apk-build.yaml index 3dc0e8f70..75a1cd383 100644 --- a/.github/workflows/android-apk-build.yaml +++ b/.github/workflows/android-apk-build.yaml @@ -98,9 +98,9 @@ jobs: run: | set -eu test -f "android/app/src/main/jniLibs/${{ env.ABI }}/libuniffi_zingo.so" - test -f "android/app/src/main/jniLibs/${{ env.ABI }}/libzingo_nym_proxy_ffi.so" + test -f "android/app/src/main/jniLibs/${{ env.ABI }}/libmixnet_proxy.so" test -f "android/app/build/generated/source/uniffi/release/java/uniffi/zingo/zingo.kt" - test -f "android/app/build/generated/source/uniffi/release/java/uniffi/zingo_nym_proxy_ffi/zingo_nym_proxy_ffi.kt" + test -f "android/app/build/generated/source/uniffi/release/java/uniffi/mixnet_proxy/mixnet_proxy.kt" - name: Remove unnecessary directories to free up space run: | diff --git a/.github/workflows/android-build.yaml b/.github/workflows/android-build.yaml index 18583eb82..c7e85b7e7 100644 --- a/.github/workflows/android-build.yaml +++ b/.github/workflows/android-build.yaml @@ -217,8 +217,8 @@ jobs: working-directory: ./rust/target/${{ env.TARGET }}/release run: mv ./libzingo.so ./libuniffi_zingo.so - - name: Cargo build nym proxy shim - working-directory: ./rust/nym-proxy-ffi + - name: Cargo build nym mixnet proxy + working-directory: ./rust/mixnet-proxy run: | cargo ndk \ --target ${{ env.TARGET }} build \ @@ -235,12 +235,12 @@ jobs: # Library mode reads the UniFFI metadata from the symbol table, so this # runs before the strip. - - name: Kotlin bindings for nym proxy shim - working-directory: ./rust/nym-proxy-ffi + - name: Kotlin bindings for nym mixnet proxy + working-directory: ./rust/mixnet-proxy run: | cargo run --release --locked --manifest-path ../Cargo.toml \ --package zingo-uniffi-bindgen --bin zingo-uniffi-bindgen -- \ - generate --library target/${{ env.TARGET }}/release/libzingo_nym_proxy_ffi.so \ + generate --library target/${{ env.TARGET }}/release/libmixnet_proxy.so \ --language kotlin --no-format --metadata-no-deps \ --out-dir ../../android/app/build/generated/source/uniffi/release/java @@ -251,17 +251,17 @@ jobs: path: android/app/build/generated/source/uniffi/release/java/uniffi retention-days: 3 - - name: LLVM Strip nym proxy shim - working-directory: ./rust/nym-proxy-ffi/target + - name: LLVM Strip nym mixnet proxy + working-directory: ./rust/mixnet-proxy/target run: | - llvm-strip --strip-all ./${{ env.TARGET }}/release/libzingo_nym_proxy_ffi.so - llvm-objcopy --remove-section .comment ./${{ env.TARGET }}/release/libzingo_nym_proxy_ffi.so + llvm-strip --strip-all ./${{ env.TARGET }}/release/libmixnet_proxy.so + llvm-objcopy --remove-section .comment ./${{ env.TARGET }}/release/libmixnet_proxy.so - name: Stage native libraries run: | mkdir -p rust/native-out cp rust/target/${{ env.TARGET }}/release/libuniffi_zingo.so rust/native-out/ - cp rust/nym-proxy-ffi/target/${{ env.TARGET }}/release/libzingo_nym_proxy_ffi.so rust/native-out/ + cp rust/mixnet-proxy/target/${{ env.TARGET }}/release/libmixnet_proxy.so rust/native-out/ - name: Upload native rust uses: actions/upload-artifact@v7 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bdd8d4927..3a7ba3489 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -61,8 +61,8 @@ jobs: with: fail-all: true - nym-proxy-ffi-check: - uses: ./.github/workflows/nym-proxy-ffi-check.yaml + mixnet-proxy-check: + uses: ./.github/workflows/mixnet-proxy-check.yaml with: fail-all: true diff --git a/.github/workflows/ios-build.yaml b/.github/workflows/ios-build.yaml index 912b52a96..462cc0a41 100644 --- a/.github/workflows/ios-build.yaml +++ b/.github/workflows/ios-build.yaml @@ -42,8 +42,8 @@ jobs: path: | ios/Zingolib.xcframework ios/zingo.swift - ios/ZingoNymProxyFFI.xcframework - ios/zingo_nym_proxy_ffi.swift + ios/MixnetProxy.xcframework + ios/mixnet_proxy.swift key: native-ios-xcframework-${{ env.CACHE-KEY }} lookup-only: true @@ -156,8 +156,8 @@ jobs: path: | ios/Zingolib.xcframework ios/zingo.swift - ios/ZingoNymProxyFFI.xcframework - ios/zingo_nym_proxy_ffi.swift + ios/MixnetProxy.xcframework + ios/mixnet_proxy.swift retention-days: 3 cache-native-ios-uniffi: @@ -187,6 +187,6 @@ jobs: path: | ios/Zingolib.xcframework ios/zingo.swift - ios/ZingoNymProxyFFI.xcframework - ios/zingo_nym_proxy_ffi.swift + ios/MixnetProxy.xcframework + ios/mixnet_proxy.swift key: native-ios-xcframework-${{ env.CACHE-KEY }} diff --git a/.github/workflows/ios-integration-test.yaml b/.github/workflows/ios-integration-test.yaml index 5e932eb42..001b62c6b 100644 --- a/.github/workflows/ios-integration-test.yaml +++ b/.github/workflows/ios-integration-test.yaml @@ -51,8 +51,8 @@ jobs: path: | ios/Zingolib.xcframework ios/zingo.swift - ios/ZingoNymProxyFFI.xcframework - ios/zingo_nym_proxy_ffi.swift + ios/MixnetProxy.xcframework + ios/mixnet_proxy.swift key: native-ios-xcframework-${{ env.CACHE-KEY }} fail-on-cache-miss: true diff --git a/.github/workflows/maestro-nightly.yaml b/.github/workflows/maestro-nightly.yaml index 92522c693..0d9be2841 100644 --- a/.github/workflows/maestro-nightly.yaml +++ b/.github/workflows/maestro-nightly.yaml @@ -151,8 +151,8 @@ jobs: path: | ios/Zingolib.xcframework ios/zingo.swift - ios/ZingoNymProxyFFI.xcframework - ios/zingo_nym_proxy_ffi.swift + ios/MixnetProxy.xcframework + ios/mixnet_proxy.swift key: native-ios-xcframework-${{ env.CACHE-KEY }} fail-on-cache-miss: true diff --git a/.github/workflows/nym-proxy-ffi-check.yaml b/.github/workflows/mixnet-proxy-check.yaml similarity index 76% rename from .github/workflows/nym-proxy-ffi-check.yaml rename to .github/workflows/mixnet-proxy-check.yaml index c57296a74..c2e44f004 100644 --- a/.github/workflows/nym-proxy-ffi-check.yaml +++ b/.github/workflows/mixnet-proxy-check.yaml @@ -1,4 +1,4 @@ -name: Mixnet proxy shim checks +name: Mixnet proxy checks on: workflow_call: @@ -11,8 +11,8 @@ on: default: false jobs: - nym-proxy-ffi-check: - name: shim check, clippy, fmt, tests + mixnet-proxy-check: + name: proxy check, clippy, fmt, tests runs-on: ubuntu-24.04 steps: - name: Checkout repository @@ -24,17 +24,17 @@ jobs: - name: Install protobuf-compiler run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - # The shim is excluded from the main workspace (own lockfile, see + # The proxy is excluded from the main workspace (own lockfile, see # rust/Cargo.toml), so workspace-wide jobs never touch it. This job # is its only host-side verdict. - - name: Cache the shim build + - name: Cache the proxy build uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git - rust/nym-proxy-ffi/target - key: nym-proxy-ffi-${{ runner.os }}-${{ hashFiles('rust/nym-proxy-ffi/Cargo.lock') }} + rust/mixnet-proxy/target + key: mixnet-proxy-${{ runner.os }}-${{ hashFiles('rust/mixnet-proxy/Cargo.lock') }} - name: Install cargo-nextest uses: taiki-e/install-action@v2 @@ -42,22 +42,22 @@ jobs: tool: cargo-nextest@0.9.98 - name: Format check - working-directory: ./rust/nym-proxy-ffi + working-directory: ./rust/mixnet-proxy run: cargo fmt --check # --workspace covers the tls-init member; its JNI body is # Android-gated, so the host lanes prove the workspace shape and the # release cross-build proves the JNI code. - name: Check - working-directory: ./rust/nym-proxy-ffi + working-directory: ./rust/mixnet-proxy run: cargo check --locked --workspace --all-targets - name: Clippy - working-directory: ./rust/nym-proxy-ffi + working-directory: ./rust/mixnet-proxy run: cargo clippy --locked --workspace --all-targets -- -D warnings - name: Tests - working-directory: ./rust/nym-proxy-ffi + working-directory: ./rust/mixnet-proxy run: cargo nextest run --locked --workspace - name: Cancel the run on failure (fail-all) @@ -73,9 +73,9 @@ jobs: # Starts the real proxy against the mixnet, handshakes its SOCKS5 listener, # and stops it. Not part of the fail-all job above. - nym-proxy-ffi-live: + mixnet-proxy-live: name: live mixnet start - needs: nym-proxy-ffi-check + needs: mixnet-proxy-check runs-on: ubuntu-24.04 steps: - name: Checkout repository @@ -84,14 +84,14 @@ jobs: - name: Install protobuf-compiler run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - - name: Cache the shim build + - name: Cache the proxy build uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git - rust/nym-proxy-ffi/target - key: nym-proxy-ffi-${{ runner.os }}-${{ hashFiles('rust/nym-proxy-ffi/Cargo.lock') }} + rust/mixnet-proxy/target + key: mixnet-proxy-${{ runner.os }}-${{ hashFiles('rust/mixnet-proxy/Cargo.lock') }} - name: Install cargo-nextest uses: taiki-e/install-action@v2 @@ -99,5 +99,5 @@ jobs: tool: cargo-nextest@0.9.98 - name: Live mixnet start - working-directory: ./rust/nym-proxy-ffi + working-directory: ./rust/mixnet-proxy run: cargo nextest run --locked --features live-mixnet --test live_mixnet diff --git a/.gitignore b/.gitignore index f59ea10fa..3f52c9174 100644 --- a/.gitignore +++ b/.gitignore @@ -33,13 +33,13 @@ android/app/beta/release/ *.aab *.apk ios/Zingolib.xcframework/ -ios/ZingoNymProxyFFI.xcframework/ +ios/MixnetProxy.xcframework/ ios/NymHost.xcframework/ ios/zingo.swift -ios/zingo_nym_proxy_ffi.swift +ios/mixnet_proxy.swift rust/lib/Generated/zingo.swift rust/lib/Generated/zingoFFI.h -rust/nym-proxy-ffi/Generated/ +rust/mixnet-proxy/Generated/ rust/lib/Generated/zingoFFI.modulemap # Android/IntelliJ diff --git a/__tests__/walletBackend.mixnetCoordinator.unit.test.ts b/__tests__/walletBackend.mixnetCoordinator.unit.test.ts index bf9e26a78..63be8f36f 100644 --- a/__tests__/walletBackend.mixnetCoordinator.unit.test.ts +++ b/__tests__/walletBackend.mixnetCoordinator.unit.test.ts @@ -210,7 +210,7 @@ describe('MixnetCoordinator', () => { it('a transport-start failure publishes the failure view and offers re-enable, never clearnet', async () => { const startTransport = jest .fn() - .mockRejectedValue(new Error('shim missing')); + .mockRejectedValue(new Error('proxy missing')); const published: MixnetView[] = []; const coordinator = new MixnetCoordinator(startTransport, noopStop, view => published.push(view), @@ -258,7 +258,7 @@ describe('MixnetCoordinator', () => { it('keeps sends blocked when the first poll after a transport failure reports off (#1226)', async () => { const startTransport = jest .fn() - .mockRejectedValue(new Error('shim missing')); + .mockRejectedValue(new Error('proxy missing')); const published: MixnetView[] = []; const coordinator = new MixnetCoordinator(startTransport, noopStop, view => published.push(view), diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index a4e2aa899..2f6365624 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -246,9 +246,9 @@ android { sourceSets { getByName("test") { - // The nym proxy shim's Kotlin wire-contract test, read from the + // The nym mixnet proxy's Kotlin wire-contract test, read from the // crate itself. No copy lives under src/test. - java.srcDir("../../rust/nym-proxy-ffi/contract-tests/kotlin") + java.srcDir("../../rust/mixnet-proxy/contract-tests/kotlin") } } @@ -259,7 +259,7 @@ android { it.systemProperty( "zingo.golden.dir", layout.projectDirectory - .dir("../../rust/nym-proxy-ffi/test-data/golden") + .dir("../../rust/mixnet-proxy/test-data/golden") .asFile.absolutePath ) } diff --git a/android/app/lint.xml b/android/app/lint.xml index eafb0d230..d2fb7cd49 100644 --- a/android/app/lint.xml +++ b/android/app/lint.xml @@ -7,6 +7,6 @@ three NewApi errors. Scoped to this generated file so NewApi stays enforced everywhere we write Kotlin by hand. --> - + diff --git a/android/app/src/main/java/org/ZingoLabs/Zingo/NymTransportModule.kt b/android/app/src/main/java/org/ZingoLabs/Zingo/NymTransportModule.kt index b8347c9d4..641053d00 100644 --- a/android/app/src/main/java/org/ZingoLabs/Zingo/NymTransportModule.kt +++ b/android/app/src/main/java/org/ZingoLabs/Zingo/NymTransportModule.kt @@ -5,15 +5,15 @@ import com.facebook.react.bridge.Promise import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactContextBaseJavaModule import com.facebook.react.bridge.ReactMethod -import uniffi.zingo_nym_proxy_ffi.MixnetProxyHandle -import uniffi.zingo_nym_proxy_ffi.ProxyDeathObserver -import uniffi.zingo_nym_proxy_ffi.ProxyDeathReason +import uniffi.mixnet_proxy.MixnetProxyHandle +import uniffi.mixnet_proxy.ProxyDeathObserver +import uniffi.mixnet_proxy.ProxyDeathReason /** * The platform half of Mixnet Mode on Android (send-over-nym step 3, - * zingolib#2513): hosts the UniFFI proxy shim (`uniffi.zingo_nym_proxy_ffi`) + * zingolib#2513): hosts the mixnet proxy (`uniffi.mixnet_proxy`) * inside the app process and offers its local SOCKS5 endpoint to the app - * layer, which hands it to the wallet's `attach_mixnet` seam. The shim is a + * layer, which hands it to the wallet's `attach_mixnet` seam. The proxy is a * UniFFI component distinct from the wallet's (`uniffi.zingo`) by ratified * decision — the loopback socket, not a shared compile unit, is the boundary * between the two lockfile-incompatible stacks. @@ -22,14 +22,14 @@ import uniffi.zingo_nym_proxy_ffi.ProxyDeathReason * binding — the `host:port` endpoint and the Exit Node it bound, both of * which the wallet's attach seam requires; `stopMixnetTransport` is the * deliberate teardown. - * A proxy that dies on its own is observed by the shim's liveness monitor; + * A proxy that dies on its own is observed by the proxy's liveness monitor; * the observer clears the stored handle so a later re-enable starts afresh, * while the wallet's own probe surfaces the `died` mode the app polls. * * Failures settle out of band in the error channel (zingo-mobile ADRs 0002 * and 0003): the promise rejects under this module's name, never prose in - * the data payload. JVM `Error`s from shim linkage are converted to - * exceptions at this boundary because a build whose APK carries no shim + * the data payload. JVM `Error`s from proxy linkage are converted to + * exceptions at this boundary because a build whose APK carries no proxy * library must degrade fail-closed — an `UnsatisfiedLinkError` becomes a * rejected start, sends stay blocked, and the app survives to offer * re-enable or the clearnet consent path. @@ -98,14 +98,14 @@ class NymTransportModule internal constructor(reactContext: ReactApplicationCont } /** - * Runs `call`, converting JVM `Error`s (a missing or mismatched shim + * Runs `call`, converting JVM `Error`s (a missing or mismatched proxy * library) into exceptions so [FfiOutcome] settles them as rejections * instead of the process dying. */ private fun guardingLinkage(call: () -> T): T = try { call() } catch (error: Error) { - throw IllegalStateException("the nym proxy shim is unavailable", error) + throw IllegalStateException("the nym mixnet proxy is unavailable", error) } @ReactMethod diff --git a/app/walletBackend/config/WalletBackendConfig.ts b/app/walletBackend/config/WalletBackendConfig.ts index 464de5f78..896b32329 100644 --- a/app/walletBackend/config/WalletBackendConfig.ts +++ b/app/walletBackend/config/WalletBackendConfig.ts @@ -50,7 +50,7 @@ export type WalletBackendConfig = { /** Called with each new screen-facing Mixnet Mode projection. */ onMixnetViewChanged: (view: MixnetView) => void; /** - * Starts the platform-hosted mixnet transport (the UniFFI proxy shim on + * Starts the platform-hosted mixnet transport (the mixnet proxy on * Android) and yields its local SOCKS5 address. Injected because the * platform owns the transport; tests supply a stub. */ diff --git a/app/walletBackend/modules/MixnetCoordinator.ts b/app/walletBackend/modules/MixnetCoordinator.ts index a05fa12cc..c33bbf80a 100644 --- a/app/walletBackend/modules/MixnetCoordinator.ts +++ b/app/walletBackend/modules/MixnetCoordinator.ts @@ -10,7 +10,7 @@ * and only a deliberate disable stops the reconnect loop. * * The transport start is an injected seam (`StartMixnetTransport`) because - * the platform owns it: on Android the UniFFI proxy shim (step 3 of the + * the platform owns it: on Android the mixnet proxy (step 3 of the * critical path) supplies it; tests supply a stub. This coordinator owns * cadence and policy only — every payload decision lives in the pure * transforms, and every screen projection in the pure presenter. diff --git a/app/walletBackend/utils/mixnetUtils.ts b/app/walletBackend/utils/mixnetUtils.ts index 0bb649c14..fab178872 100644 --- a/app/walletBackend/utils/mixnetUtils.ts +++ b/app/walletBackend/utils/mixnetUtils.ts @@ -26,7 +26,7 @@ async function statusCall( /** * Attach Mixnet Mode to an already-running, platform-hosted SOCKS5 endpoint - * (the proxy shim's address) that bound `exitNode`. Poll [`getMixnetStatus`] + * (the mixnet proxy's address) that bound `exitNode`. Poll [`getMixnetStatus`] * for `bootstrapping` -> `ready`, or `died`. */ export async function attachMixnet( @@ -38,7 +38,7 @@ export async function attachMixnet( /** * Enable Mixnet Mode by spawning a bundled nym-proxy binary (the exec - * fallback; the shim-hosted path uses [`attachMixnet`] instead). + * fallback; the proxy-hosted path uses [`attachMixnet`] instead). */ export async function enableMixnet( proxyPath: string, diff --git a/app/walletBackend/utils/nymTransport.ts b/app/walletBackend/utils/nymTransport.ts index 8ead9f34d..67e9ad688 100644 --- a/app/walletBackend/utils/nymTransport.ts +++ b/app/walletBackend/utils/nymTransport.ts @@ -8,7 +8,7 @@ import { // One-to-one mirror of the native NymTransportModule, exposed on both // platforms (Android: org.ZingoLabs.Zingo.NymTransportModule; iOS: // NymTransportModule.swift). This is the platform half -// of Mixnet Mode: the module hosts the UniFFI proxy shim in-process and +// of Mixnet Mode: the module hosts the mixnet proxy in-process and // offers its binding — the local SOCKS5 endpoint as a bare `host:port` and // the Exit Node the proxy bound — which the MixnetCoordinator hands to // the wallet's attach seam. Failures arrive only as rejections (the typed @@ -31,7 +31,7 @@ export const startMixnetTransport: StartMixnetTransport = () => /** * Deliberate teardown of the platform-hosted proxy (app shutdown or the - * user's per-session clearnet consent). A stop is not a death: the shim + * user's per-session clearnet consent). A stop is not a death: the proxy * cancels its liveness monitor before the listener goes down. */ export async function stopMixnetTransport(): Promise { diff --git a/docs/adr/0004-the-mixnet-shims-tls-verifies-against-androids-platform-verifier.md b/docs/adr/0004-the-mixnet-proxys-tls-verifies-against-androids-platform-verifier.md similarity index 71% rename from docs/adr/0004-the-mixnet-shims-tls-verifies-against-androids-platform-verifier.md rename to docs/adr/0004-the-mixnet-proxys-tls-verifies-against-androids-platform-verifier.md index 1e76ceadd..13843e824 100644 --- a/docs/adr/0004-the-mixnet-shims-tls-verifies-against-androids-platform-verifier.md +++ b/docs/adr/0004-the-mixnet-proxys-tls-verifies-against-androids-platform-verifier.md @@ -1,4 +1,4 @@ -# 4. The mixnet shim's TLS verifies against Android's platform verifier +# 4. The mixnet proxy's TLS verifies against Android's platform verifier Date: 2026-08-10 @@ -9,44 +9,44 @@ Nym's own API certificate as revoked, for carrying no OCSP responder, on every image tested, so the mixnet proxy never starts. Accepted before that, ratified by the maintainer during the PR #1276 review. The counterpart decision for the desktop workspace is zingolib ADR 0021, -whose 2026-08-10 amendment delegates the shim's verifier to this +whose 2026-08-10 amendment delegates the proxy's verifier to this repository. ## Context zingolib ADR 0021 chose a compiled-in Mozilla root bundle for the -mixnet stack's TLS because the shim then lived in the zingolib +mixnet stack's TLS because the proxy then lived in the zingolib workspace, which could provide neither the JVM-side initialization `rustls-platform-verifier` requires on Android nor any hand-written JNI (its `#![forbid(unsafe_code)]` invariant). Without that initialization the verifier cannot reach Android's certificate store, and every mixnet enable died at the first TLS handshake (zingolib#2531). -PR #1276 moved the shim into this repository, whose git dependency on +PR #1276 moved the proxy into this repository, whose git dependency on `zingo-netutils` does not carry zingolib's `[patch.crates-io]` substitution — a patch never crosses a workspace root. Left alone, the -shim would resolve the real `rustls-platform-verifier` uninitialized +proxy would resolve the real `rustls-platform-verifier` uninitialized and reproduce zingolib#2531. Unlike a library workspace, this app owns an application `Context`, a Kotlin source set, and its gradle build, so it can initialize the real verifier properly. ## Decision -The shim's TLS uses `rustls-platform-verifier` unpatched, verifying +The proxy's TLS uses `rustls-platform-verifier` unpatched, verifying against Android's own certificate verifier. Three parts wire it: -- `rust/nym-proxy-ffi/tls-init`, the one hand-written JNI seam, exports +- `rust/mixnet-proxy/tls-init`, the one hand-written JNI seam, exports `Java_org_ZingoLabs_Zingo_NymTlsInit_initPlatformVerifier`, which hands the JVM and the application `Context` to the verifier. It lives - outside the shim crate because `#[no_mangle]` is rejected by the - shim's `forbid(unsafe_code)`; the shim links it on Android targets so - the symbol ships inside `libzingo_nym_proxy_ffi.so`. -- `NymTlsInit` (Kotlin) loads the shim library and calls that export. + outside the proxy crate because `#[no_mangle]` is rejected by the + proxy's `forbid(unsafe_code)`; the proxy links it on Android targets so + the symbol ships inside `libmixnet_proxy.so`. +- `NymTlsInit` (Kotlin) loads the proxy library and calls that export. `NymTransportModule.startMixnetTransport` invokes it before every proxy start; re-initialization is a no-op. - The app's gradle build consumes the verifier's Kotlin component from the cargo checkout (it is not on Maven), so the Kotlin and Rust - halves always share the one version the shim's lockfile pins. + halves always share the one version the proxy's lockfile pins. ## Consequences @@ -57,6 +57,6 @@ and this repository accepts as ordinary properties of a mobile app: verification behavior differs per platform vendor, and a device with a hostile user-installed CA trusts it. iOS needs no counterpart, because the verifier reaches Apple's Security framework without -initialization. The invariant to preserve is order — no shim TLS +initialization. The invariant to preserve is order — no proxy TLS before `NymTlsInit.initPlatformVerifier` — and the module enforces it at the only start seam. diff --git a/docs/adr/0005-the-proxy-component-is-named-for-the-mixnet.md b/docs/adr/0005-the-proxy-component-is-named-for-the-mixnet.md new file mode 100644 index 000000000..ceff510ef --- /dev/null +++ b/docs/adr/0005-the-proxy-component-is-named-for-the-mixnet.md @@ -0,0 +1,118 @@ +# 5. The proxy component is named for the mixnet + +Date: 2026-08-19 + +## Status + +Accepted, ruled by the maintainer on 2026-08-19. The rename was deferred +to a follow-on pull request, because its scope reaches every build system +in the repository and does not belong inside PR #1276. That pull request +carried it out on 2026-08-21, and this ADR's Consequences overstate the +work in one respect: PR #1291 had already stopped checking the generated +bindings into git, so those paths no longer existed to move. + +## Context + +The crate is `zingo-nym-proxy-ffi`, and because it uses +`uniffi::setup_scaffolding!` rather than a UDL, that crate name becomes the +component namespace: Kotlin imports `uniffi.zingo_nym_proxy_ffi`, and the +generated scaffolding exports C-ABI symbols named +`ffi_zingo_nym_proxy_ffi_*`. + +Three separate things are wrong with that name, and each is visible from +inside the crate itself. + +The vendor name is the odd one out. Every type the crate exports is already +neutral about which mixnet it carries: `MixnetProxyHandle`, +`Socks5Endpoint`, `ProxyFfiError`, `ProxyDeathReason`, `ProxyDeathObserver`. +"Nym" survives only in the crate name and in an internal comment about +`NymProxy`. The wallet uses the same neutral vocabulary throughout — Mixnet +Mode, `MixnetProxy`, `MixnetSlot`, `MixnetTiming` — so the component name +is the single place the implementation choice leaks into the interface. + +The `_ffi` suffix names the mechanism rather than the thing, and it states +that mechanism a third time. Every consumer already reaches the component +as `uniffi.`, and the crate exists for no purpose other than being +bound. The wallet component settles the house convention by counterexample: +it is every bit as much an FFI component, with a UDL and generated Kotlin, +and it is named `zingo`, not `zingo_ffi`. + +The word "shim" describes the crate's posture toward its own dependencies +rather than what a caller receives. A consumer across the boundary holds a +handle to a running mixnet proxy and calls `start`, `socks5Endpoint`, +`exitNode`, and `stop`. That it happens to wrap `NymProxy` from +`zingo-netutils` is invisible to them and irrelevant to the name. + +## Decision + +The crate is `mixnet-proxy`. The component namespace is `mixnet_proxy`, +so Kotlin imports `uniffi.mixnet_proxy` and the scaffolding exports +`ffi_mixnet_proxy_*`. The word "shim" is retired from the vocabulary of +this repository, in prose, in file names, and in identifiers; where a name +is needed, the thing is the mixnet proxy. + +The wallet component keeps the name `zingo` for now. + +## Considered options + +**Keep `zingo-nym-proxy-ffi`.** Rejected. It names a vendor the interface +does not expose, and a mechanism the import path already states. + +**`zingo-mixnet-proxy`.** Rejected, though it carries a real argument. Both +components are bound into one application process, so their C-ABI symbols +share a global namespace with every other native library the application +links, and a `zingo_` prefix both reduces the chance of a collision with a +third-party UniFFI component and makes a symbol legible as ours in a crash +dump or a linker error. It also pairs visibly with `uniffi.zingo`. The +maintainer ruled against the prefix: within this repository the component +is unambiguous, and the shorter name says what the thing is without +restating where it lives. + +**`mixnet-proxy`.** Chosen. + +## Consequences + +The symbol prefix becomes generic. `ffi_mixnet_proxy_*` is a plausible name +for another party's component, so a future collision is possible where +`ffi_zingo_mixnet_proxy_*` would have been safe, and a symbol in a crash +dump no longer identifies itself as ours. This decision accepts that cost. + +The name will overstate the crate's reach until its couplings are cut. It +depends on `zingo-netutils` for `NymProxy` and bootstraps TLS through +`org.ZingoLabs.Zingo.NymTlsInit`, so a consumer outside Zingo cannot use it +today. A name that invites reuse should either acquire that reuse or lose +those couplings; whichever happens, it should happen deliberately. + +The rename is large and touches systems that cannot all be verified from +one place. Roughly 316 identifier sites across about 35 files carry the old +names, spanning Cargo manifests, `uniffi-bindgen`, two workbench binaries, +`android/app/build.gradle.kts`, `android/app/lint.xml`, +`ios/Zingo.xcodeproj/project.pbxproj`, `ios/NymTransportModule.swift`, +three `build_*.mjs` scripts, `rust/android/docker/Dockerfile`, the contract +tests, and ADR 0004. Seven paths change too, including the crate directory, +the checked-in generated bindings under `android/app/src/*/java/uniffi/`, +the workflow file `nym-proxy-ffi-check.yaml`, both `*-android-shim.rs` +workbench binaries, and this repository's ADR 0004, whose file name +contains the retired word. Cargo verifies only the Rust portion; Gradle, +Xcode, and CI each need their own build, which is the reason this is a +pull request of its own rather than a change carried inside another. + +ADR 0004 is renamed and its prose updated by the same change. Its decision +is untouched: the platform verifier must hold the application Context +before the proxy opens any connection. + +## Open + +Whether the wallet component becomes `zingo_wallet`. Beside +`uniffi.mixnet_proxy`, the bare `uniffi.zingo` claims the product name for +one component among several, and two peers would read better as +`uniffi.zingo_wallet` and `uniffi.mixnet_proxy`. That rename moves the +crate name `zingo`, hence the built library, the UDL namespace, the +checked-in bindings, every Kotlin and Swift import, and the loader +configuration, so it is a larger change than this one and wants its own +decision. + +Whether the React Native module classes `NymTransportModule` and +`NymTlsInit` are renamed with the component. They name the application's +bridge module rather than the component, so they are application +vocabulary and are left to a separate ruling. diff --git a/docs/adr/0006-the-mixnet-proxys-tls-verifies-against-the-compiled-in-mozilla-bundle.md b/docs/adr/0006-the-mixnet-proxys-tls-verifies-against-the-compiled-in-mozilla-bundle.md index 71a37b672..59300f9af 100644 --- a/docs/adr/0006-the-mixnet-proxys-tls-verifies-against-the-compiled-in-mozilla-bundle.md +++ b/docs/adr/0006-the-mixnet-proxys-tls-verifies-against-the-compiled-in-mozilla-bundle.md @@ -6,7 +6,7 @@ Date: 2026-08-21 Accepted. Supersedes ADR 0004, which chose Android's platform verifier. This decision returns the mixnet proxy to zingolib ADR 0021 and restates -that ADR's patch inside this repository's shim workspace. +that ADR's patch inside this repository's proxy workspace. ## Context @@ -36,15 +36,15 @@ which is why the fault presented for weeks as a wallet stuck bootstrapping. ## Decision -The shim workspace carries its own `[patch.crates-io]` substituting +The proxy workspace carries its own `[patch.crates-io]` substituting `rustls-platform-verifier` with zingolib's `webpki-verifier-shim`, which verifies against the compiled-in Mozilla root bundle. The patch is necessary here because Cargo honours `[patch]` only from the workspace -being built, and `rust/nym-proxy-ffi` is a separate workspace from +being built, and `rust/mixnet-proxy` is a separate workspace from `zingo-netutils`, so zingolib's stanza never reaches it. Three parts of ADR 0004 are deleted rather than disabled. The JNI seam -`rust/nym-proxy-ffi/tls-init` and its export are gone, which removes the +`rust/mixnet-proxy/tls-init` and its export are gone, which removes the repository's only hand-written `#[no_mangle]`. The Kotlin `NymTlsInit` object and its call in `NymTransportModule.startMixnetTransport` are gone. The gradle `cargo metadata` query, the maven repository it derived, and the diff --git a/ios/NymTransportModule.swift b/ios/NymTransportModule.swift index 380745632..e031e60b1 100644 --- a/ios/NymTransportModule.swift +++ b/ios/NymTransportModule.swift @@ -3,7 +3,7 @@ // Zingo // // The iOS half of Mixnet Mode, a mirror of the Android NymTransportModule. -// It hosts the UniFFI proxy shim (`zingo_nym_proxy_ffi`) inside the app +// It hosts the mixnet proxy (`mixnet_proxy`) inside the app // process and offers its local SOCKS5 endpoint to the app layer, which hands // it to the wallet's `attach_mixnet` seam. The loopback socket, not a shared // compile unit, is the boundary between the two lockfile-incompatible stacks. @@ -12,7 +12,7 @@ // binding — the `host:port` endpoint and the Exit Node it bound, both of // which the wallet's attach seam requires; `stopMixnetTransport` is the // deliberate teardown. -// A proxy that dies on its own is caught by the shim's liveness monitor; the +// A proxy that dies on its own is caught by the proxy's liveness monitor; the // observer clears the stored handle so a later re-enable starts afresh, while // the wallet's own probe surfaces the `died` mode the app polls. // diff --git a/ios/Zingo.xcodeproj/project.pbxproj b/ios/Zingo.xcodeproj/project.pbxproj index d532368a7..66c556c89 100644 --- a/ios/Zingo.xcodeproj/project.pbxproj +++ b/ios/Zingo.xcodeproj/project.pbxproj @@ -26,15 +26,15 @@ 1FA935B32BE457B100117DF5 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F7D321C2B71D44800D2879C /* SystemConfiguration.framework */; }; 1FC1E2172BE443270064963B /* ZingoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FC1E2162BE443270064963B /* ZingoTest.swift */; }; 1FE8E9AC296B85FC004A256B /* BackgroundTasks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FE8E9AB296B85FC004A256B /* BackgroundTasks.framework */; }; - 37F88F63B5EAB542D9638B06 /* ZingoNymProxyFFI.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1925119FD8B24B809B9A31C /* ZingoNymProxyFFI.xcframework */; }; + 37F88F63B5EAB542D9638B06 /* MixnetProxy.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1925119FD8B24B809B9A31C /* MixnetProxy.xcframework */; }; 39916E0E0696D2BA46897D37 /* NymTransportModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A6912D48B65F0E8D6E7619 /* NymTransportModule.swift */; }; 406B854C612CDFA4B10C5B0A /* NymTransportModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A6912D48B65F0E8D6E7619 /* NymTransportModule.swift */; }; - 5E39D39B9B57469EEF50715D /* zingo_nym_proxy_ffi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8866047183EF780F88A845B6 /* zingo_nym_proxy_ffi.swift */; }; - 72F4BE964DE9305F904FFD47 /* ZingoNymProxyFFI.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1925119FD8B24B809B9A31C /* ZingoNymProxyFFI.xcframework */; }; + 5E39D39B9B57469EEF50715D /* mixnet_proxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8866047183EF780F88A845B6 /* mixnet_proxy.swift */; }; + 72F4BE964DE9305F904FFD47 /* MixnetProxy.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1925119FD8B24B809B9A31C /* MixnetProxy.xcframework */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; C15AEBBCEC942FCAC1519FEA /* libPods-Zingo-ZingoTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 96E8D7BC5D3F3F73EA296DFA /* libPods-Zingo-ZingoTests.a */; }; E3B3E80957D603CCE394CAF9 /* NymTransportModuleBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = DD87BEDB3F10BB201D3845B8 /* NymTransportModuleBridge.m */; }; - EEE4199FE8378DA314A03A16 /* zingo_nym_proxy_ffi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8866047183EF780F88A845B6 /* zingo_nym_proxy_ffi.swift */; }; + EEE4199FE8378DA314A03A16 /* mixnet_proxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8866047183EF780F88A845B6 /* mixnet_proxy.swift */; }; F2BBD0386AE916EE94551101 /* NymTransportModuleBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = DD87BEDB3F10BB201D3845B8 /* NymTransportModuleBridge.m */; }; FBBD6650421A473A90DAF827 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DB06295A2A14F70A7A5B566 /* SceneDelegate.swift */; }; /* End PBXBuildFile section */ @@ -74,7 +74,7 @@ 2F9D6FF10235F3542D03A74F /* Pods-Zingo-ZingoTests.release-beta.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Zingo-ZingoTests.release-beta.xcconfig"; path = "Target Support Files/Pods-Zingo-ZingoTests/Pods-Zingo-ZingoTests.release-beta.xcconfig"; sourceTree = ""; }; 463BF6F44C15894CDBA4AC91 /* Pods-Zingo-ZingoTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Zingo-ZingoTests.debug.xcconfig"; path = "Target Support Files/Pods-Zingo-ZingoTests/Pods-Zingo-ZingoTests.debug.xcconfig"; sourceTree = ""; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = Zingo/LaunchScreen.storyboard; sourceTree = ""; }; - 8866047183EF780F88A845B6 /* zingo_nym_proxy_ffi.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = zingo_nym_proxy_ffi.swift; sourceTree = ""; }; + 8866047183EF780F88A845B6 /* mixnet_proxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = mixnet_proxy.swift; sourceTree = ""; }; 8D3BF7AA625B511948B47DA8 /* Pods-Zingo.debug-beta.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Zingo.debug-beta.xcconfig"; path = "Target Support Files/Pods-Zingo/Pods-Zingo.debug-beta.xcconfig"; sourceTree = ""; }; 8E84DCC50BD0296D0F292579 /* Pods-Zingo-ZingoTests.debug-beta.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Zingo-ZingoTests.debug-beta.xcconfig"; path = "Target Support Files/Pods-Zingo-ZingoTests/Pods-Zingo-ZingoTests.debug-beta.xcconfig"; sourceTree = ""; }; 96E8D7BC5D3F3F73EA296DFA /* libPods-Zingo-ZingoTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Zingo-ZingoTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -82,7 +82,7 @@ DD87BEDB3F10BB201D3845B8 /* NymTransportModuleBridge.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = NymTransportModuleBridge.m; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; F0A6912D48B65F0E8D6E7619 /* NymTransportModule.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NymTransportModule.swift; sourceTree = ""; }; - F1925119FD8B24B809B9A31C /* ZingoNymProxyFFI.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = ZingoNymProxyFFI.xcframework; sourceTree = ""; }; + F1925119FD8B24B809B9A31C /* MixnetProxy.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = MixnetProxy.xcframework; sourceTree = ""; }; F2A2758701DF7B0BD33CA9F0 /* Pods-Zingo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Zingo.debug.xcconfig"; path = "Target Support Files/Pods-Zingo/Pods-Zingo.debug.xcconfig"; sourceTree = ""; }; FB533652A711DBB0ED4E4306 /* Pods-Zingo.release-beta.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Zingo.release-beta.xcconfig"; path = "Target Support Files/Pods-Zingo/Pods-Zingo.release-beta.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -95,7 +95,7 @@ 1FA935B32BE457B100117DF5 /* SystemConfiguration.framework in Frameworks */, 1F9FDA9C2FBD5CEC000C5248 /* Zingolib.xcframework in Frameworks */, C15AEBBCEC942FCAC1519FEA /* libPods-Zingo-ZingoTests.a in Frameworks */, - 72F4BE964DE9305F904FFD47 /* ZingoNymProxyFFI.xcframework in Frameworks */, + 72F4BE964DE9305F904FFD47 /* MixnetProxy.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -107,7 +107,7 @@ 1F9FDA9B2FBD5CEC000C5248 /* Zingolib.xcframework in Frameworks */, 1F7D321D2B71D44800D2879C /* SystemConfiguration.framework in Frameworks */, 12BF9D27B26430347C700A81 /* libPods-Zingo.a in Frameworks */, - 37F88F63B5EAB542D9638B06 /* ZingoNymProxyFFI.xcframework in Frameworks */, + 37F88F63B5EAB542D9638B06 /* MixnetProxy.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -160,7 +160,7 @@ 1F9FDA9A2FBD5CEC000C5248 /* Zingolib.xcframework */, 293E2F479737E71EC621F947 /* libPods-Zingo.a */, 96E8D7BC5D3F3F73EA296DFA /* libPods-Zingo-ZingoTests.a */, - F1925119FD8B24B809B9A31C /* ZingoNymProxyFFI.xcframework */, + F1925119FD8B24B809B9A31C /* MixnetProxy.xcframework */, ); name = Frameworks; sourceTree = ""; @@ -183,7 +183,7 @@ 83CBBA001A601CBA00E9B192 /* Products */, 2D16E6871FA4F8E400B85C8A /* Frameworks */, 8BB7EBE9935B479E64CBB9A8 /* Pods */, - 8866047183EF780F88A845B6 /* zingo_nym_proxy_ffi.swift */, + 8866047183EF780F88A845B6 /* mixnet_proxy.swift */, ); indentWidth = 2; sourceTree = ""; @@ -494,7 +494,7 @@ 1F5E677C2BD30D0A007B17AA /* zingo.swift in Sources */, 1FA935B02BE4506300117DF5 /* RPCModule.swift in Sources */, 1FC1E2172BE443270064963B /* ZingoTest.swift in Sources */, - 5E39D39B9B57469EEF50715D /* zingo_nym_proxy_ffi.swift in Sources */, + 5E39D39B9B57469EEF50715D /* mixnet_proxy.swift in Sources */, 39916E0E0696D2BA46897D37 /* NymTransportModule.swift in Sources */, F2BBD0386AE916EE94551101 /* NymTransportModuleBridge.m in Sources */, ); @@ -510,7 +510,7 @@ 1F5E677B2BD30D0A007B17AA /* zingo.swift in Sources */, 1F5569272BBCB4D900F2CD6C /* RPCModule.swift in Sources */, 1F5569292BBCB98100F2CD6C /* RPCModuleBridge.m in Sources */, - EEE4199FE8378DA314A03A16 /* zingo_nym_proxy_ffi.swift in Sources */, + EEE4199FE8378DA314A03A16 /* mixnet_proxy.swift in Sources */, 406B854C612CDFA4B10C5B0A /* NymTransportModule.swift in Sources */, E3B3E80957D603CCE394CAF9 /* NymTransportModuleBridge.m in Sources */, ); diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 65e5f3615..628dde4e1 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -8,9 +8,9 @@ members = [ "uniffi-bindgen", ] -# The mixnet proxy shim resolves in its own lockfile: nym-sdk's transitive +# The mixnet proxy resolves in its own lockfile: nym-sdk's transitive # graph needs `crypto-common ^0.2`, irreconcilable with this workspace's pins. -exclude = ["nym-proxy-ffi"] +exclude = ["mixnet-proxy"] resolver = "2" [workspace.dependencies] diff --git a/rust/android/build_android.mjs b/rust/android/build_android.mjs index 59eee9fb0..530dc6eec 100644 --- a/rust/android/build_android.mjs +++ b/rust/android/build_android.mjs @@ -90,23 +90,23 @@ try { ]); } - console.log('\n=== Extracting Nym shim .so artifacts ==='); + console.log('\n=== Extracting mixnet proxy .so artifacts ==='); for (const { triple, jniDir } of ABIS) { run('docker', [ 'cp', - `${containerId}:/opt/zingo/rust/nym-proxy-ffi/target/${triple}/release/libzingo_nym_proxy_ffi.so`, - join(JNI_PATH, jniDir, 'libzingo_nym_proxy_ffi.so'), + `${containerId}:/opt/zingo/rust/mixnet-proxy/target/${triple}/release/libmixnet_proxy.so`, + join(JNI_PATH, jniDir, 'libmixnet_proxy.so'), ]); } - console.log('\n=== Extracting Nym shim Kotlin bindings ==='); + console.log('\n=== Extracting mixnet proxy Kotlin bindings ==='); for (const variant of ['debug', 'release']) { - const shimKtDir = join(UNIFFI_PATH, variant, 'java', 'uniffi', 'zingo_nym_proxy_ffi'); - mkdirSync(shimKtDir, { recursive: true }); + const proxyKtDir = join(UNIFFI_PATH, variant, 'java', 'uniffi', 'mixnet_proxy'); + mkdirSync(proxyKtDir, { recursive: true }); run('docker', [ 'cp', - `${containerId}:/opt/zingo/rust/nym-proxy-ffi/generated-kotlin/uniffi/zingo_nym_proxy_ffi/zingo_nym_proxy_ffi.kt`, - join(shimKtDir, 'zingo_nym_proxy_ffi.kt'), + `${containerId}:/opt/zingo/rust/mixnet-proxy/generated-kotlin/uniffi/mixnet_proxy/mixnet_proxy.kt`, + join(proxyKtDir, 'mixnet_proxy.kt'), ]); } } finally { diff --git a/rust/android/build_android_local.mjs b/rust/android/build_android_local.mjs index 19567c5b4..81dd8f899 100644 --- a/rust/android/build_android_local.mjs +++ b/rust/android/build_android_local.mjs @@ -140,7 +140,7 @@ if (!capture('bindgen', ['--version'])) { missing.push('bindgen-cli: cargo install --force --locked bindgen-cli'); } // lightwallet-protocol's `rebuild-proto` feature (enabled by both zingolib and -// nym-proxy-ffi) runs tonic-prost-build, which shells out to protoc from PATH. +// mixnet-proxy) runs tonic-prost-build, which shells out to protoc from PATH. if (!capture('protoc', ['--version'])) { missing.push( 'protoc: apt install protobuf-compiler (Linux), brew install protobuf (macOS), winget install Google.Protobuf (Windows)', @@ -212,10 +212,10 @@ for (const abi of abis) { copyFileSync(soPath, join(dstDir, 'libuniffi_zingo.so')); } -console.log('\n=== Building Nym proxy shim (nym-proxy-ffi) ==='); -const NYM_BUNDLE = join(RUST_DIR, 'nym-proxy-ffi', 'target', 'android-shim'); -const SHIM_SO = 'libzingo_nym_proxy_ffi.so'; -const shimAbiFlags = abis.flatMap(abi => ['--abi', ABI_TABLE[abi].jniDir]); +console.log('\n=== Building mixnet proxy (mixnet-proxy) ==='); +const PROXY_BUNDLE = join(RUST_DIR, 'mixnet-proxy', 'target', 'android-proxy'); +const PROXY_SO = 'libmixnet_proxy.so'; +const proxyAbiFlags = abis.flatMap(abi => ['--abi', ABI_TABLE[abi].jniDir]); run( 'cargo', @@ -224,9 +224,9 @@ run( '-p', 'workbench', '--bin', - 'bundle-android-shim', + 'bundle-android-proxy', '--', - ...shimAbiFlags, + ...proxyAbiFlags, ], { env, cwd: RUST_DIR }, ); @@ -237,15 +237,15 @@ run( '-p', 'workbench', '--bin', - 'consume-android-shim', + 'consume-android-proxy', '--', '--bundle', - NYM_BUNDLE, + PROXY_BUNDLE, ], { env, cwd: RUST_DIR }, ); -// --- Kotlin bindings: the wallet from the UDL, the shim from the unstripped +// --- Kotlin bindings: the wallet from the UDL, the proxy from the unstripped // bundle library --- run( process.execPath, @@ -253,15 +253,15 @@ run( join(REPO_DIR, 'scripts', 'generate_kotlin_bindings.mjs'), '--variants', 'debug,release', - '--shim-library', - join(NYM_BUNDLE, 'jniLibs', ABI_TABLE[abis[0]].jniDir, SHIM_SO), + '--proxy-library', + join(PROXY_BUNDLE, 'jniLibs', ABI_TABLE[abis[0]].jniDir, PROXY_SO), ], { env, cwd: REPO_DIR }, ); -// Strip the staged shim .so, matching the wallet .so treatment above. +// Strip the staged proxy .so, matching the wallet .so treatment above. for (const abi of abis) { - const staged = join(JNI_PATH, ABI_TABLE[abi].jniDir, SHIM_SO); + const staged = join(JNI_PATH, ABI_TABLE[abi].jniDir, PROXY_SO); run(join(NDK_TOOLCHAIN, `llvm-strip${exe}`), ['--strip-all', staged], { env, }); @@ -273,4 +273,4 @@ for (const abi of abis) { console.log(`sha256 ${sha256File(staged)} ${staged}`); } -console.log(`\nDone. ABIs built: ${abis.join(', ')} (wallet + nym-proxy-ffi)`); +console.log(`\nDone. ABIs built: ${abis.join(', ')} (wallet + mixnet-proxy)`); diff --git a/rust/android/docker/Dockerfile b/rust/android/docker/Dockerfile index ddf5a16d5..a85b4f128 100644 --- a/rust/android/docker/Dockerfile +++ b/rust/android/docker/Dockerfile @@ -27,7 +27,7 @@ COPY uniffi-bindgen/ /opt/zingo/rust/uniffi-bindgen/ ARG ZINGO_MOBILE_GIT_DESCRIBE ENV ZINGO_MOBILE_GIT_DESCRIBE=${ZINGO_MOBILE_GIT_DESCRIBE} -COPY nym-proxy-ffi/ /opt/zingo/rust/nym-proxy-ffi/ +COPY mixnet-proxy/ /opt/zingo/rust/mixnet-proxy/ RUN rustup default stable @@ -96,45 +96,45 @@ RUN llvm-objcopy \ ../target/x86_64-linux-android/release/libzingo.so RUN sha256sum ../target/x86_64-linux-android/release/libzingo.so -# ===== Nym proxy shim (nym-proxy-ffi) ===== -# Cross-compile the shim per ABI in its own workspace (nym-sdk resolves only in -# nym-proxy-ffi's lock), mirroring the wallet's per-ABI CC/env above. Kotlin bindings +# ===== mixnet proxy (mixnet-proxy) ===== +# Cross-compile the proxy per ABI in its own workspace (nym-sdk resolves only in +# mixnet-proxy's lock), mirroring the wallet's per-ABI CC/env above. Kotlin bindings # come from library mode against a built .so (proc-macro uniffi, no UDL). -WORKDIR /opt/zingo/rust/nym-proxy-ffi -ENV SHIM=libzingo_nym_proxy_ffi.so +WORKDIR /opt/zingo/rust/mixnet-proxy +ENV PROXY=libmixnet_proxy.so # aarch64 ENV CARGO_FEATURE_STD=true ENV CC=aarch64-linux-android26-clang -RUN cargo ndk --target aarch64-linux-android build --release --package zingo-nym-proxy-ffi +RUN cargo ndk --target aarch64-linux-android build --release --package mixnet-proxy RUN cargo run --release --manifest-path /opt/zingo/rust/Cargo.toml \ --package zingo-uniffi-bindgen -- generate \ - --library target/aarch64-linux-android/release/$SHIM \ + --library target/aarch64-linux-android/release/$PROXY \ --language kotlin --out-dir generated-kotlin -RUN llvm-strip --strip-all target/aarch64-linux-android/release/$SHIM -RUN llvm-objcopy --remove-section .comment target/aarch64-linux-android/release/$SHIM -RUN sha256sum target/aarch64-linux-android/release/$SHIM +RUN llvm-strip --strip-all target/aarch64-linux-android/release/$PROXY +RUN llvm-objcopy --remove-section .comment target/aarch64-linux-android/release/$PROXY +RUN sha256sum target/aarch64-linux-android/release/$PROXY # armv7 ENV CARGO_FEATURE_STD=false ENV CC=armv7a-linux-androideabi26-clang -RUN cargo ndk --target armv7-linux-androideabi build --release --package zingo-nym-proxy-ffi -RUN llvm-strip --strip-all target/armv7-linux-androideabi/release/$SHIM -RUN llvm-objcopy --remove-section .comment target/armv7-linux-androideabi/release/$SHIM -RUN sha256sum target/armv7-linux-androideabi/release/$SHIM +RUN cargo ndk --target armv7-linux-androideabi build --release --package mixnet-proxy +RUN llvm-strip --strip-all target/armv7-linux-androideabi/release/$PROXY +RUN llvm-objcopy --remove-section .comment target/armv7-linux-androideabi/release/$PROXY +RUN sha256sum target/armv7-linux-androideabi/release/$PROXY # i686 - x86 ENV CC=i686-linux-android26-clang -RUN cargo ndk --target i686-linux-android build --release --package zingo-nym-proxy-ffi -RUN llvm-strip --strip-all target/i686-linux-android/release/$SHIM -RUN llvm-objcopy --remove-section .comment target/i686-linux-android/release/$SHIM -RUN sha256sum target/i686-linux-android/release/$SHIM +RUN cargo ndk --target i686-linux-android build --release --package mixnet-proxy +RUN llvm-strip --strip-all target/i686-linux-android/release/$PROXY +RUN llvm-objcopy --remove-section .comment target/i686-linux-android/release/$PROXY +RUN sha256sum target/i686-linux-android/release/$PROXY # x86_64 ENV CC=x86_64-linux-android26-clang -RUN cargo ndk --target x86_64-linux-android build --release --package zingo-nym-proxy-ffi -RUN llvm-strip --strip-all target/x86_64-linux-android/release/$SHIM -RUN llvm-objcopy --remove-section .comment target/x86_64-linux-android/release/$SHIM -RUN sha256sum target/x86_64-linux-android/release/$SHIM +RUN cargo ndk --target x86_64-linux-android build --release --package mixnet-proxy +RUN llvm-strip --strip-all target/x86_64-linux-android/release/$PROXY +RUN llvm-objcopy --remove-section .comment target/x86_64-linux-android/release/$PROXY +RUN sha256sum target/x86_64-linux-android/release/$PROXY diff --git a/rust/ios/build_ios.mjs b/rust/ios/build_ios.mjs index e88d27fbb..fce9c255d 100644 --- a/rust/ios/build_ios.mjs +++ b/rust/ios/build_ios.mjs @@ -84,23 +84,23 @@ run('lipo', [ '-output', SIM_FAT_LIB, ]); -// 4. Build the Nym proxy shim (nym-proxy-ffi) libraries + Swift bindings. The shim -// links nym-sdk, which resolves only in rust/nym-proxy-ffi's own lock, so it +// 4. Build the mixnet proxy (mixnet-proxy) libraries + Swift bindings. The proxy +// links nym-sdk, which resolves only in rust/mixnet-proxy's own lock, so it // builds apart from the wallet library above. Both static libraries link // into the same app and share ONE module map (step 5), so there is never a // second include/module.modulemap to collide with the wallet's. -console.log('\n=== Building Nym proxy shim (nym-proxy-ffi) ==='); -const NYM_DIR = join(RUST_DIR, 'nym-proxy-ffi'); -const NYM_TARGET_DIR = join(NYM_DIR, 'target'); -const NYM_GENERATED = join(NYM_DIR, 'Generated'); -const SHIM_LIB = 'libzingo_nym_proxy_ffi.a'; -const NYM_DEVICE_LIB = join(NYM_TARGET_DIR, DEVICE_TARGET, 'release', SHIM_LIB); +console.log('\n=== Building mixnet proxy (mixnet-proxy) ==='); +const PROXY_DIR = join(RUST_DIR, 'mixnet-proxy'); +const NYM_TARGET_DIR = join(PROXY_DIR, 'target'); +const NYM_GENERATED = join(PROXY_DIR, 'Generated'); +const PROXY_LIB = 'libmixnet_proxy.a'; +const NYM_DEVICE_LIB = join(NYM_TARGET_DIR, DEVICE_TARGET, 'release', PROXY_LIB); const NYM_SIM_FAT_DIR = join(NYM_TARGET_DIR, 'universal-sim', 'release'); -const NYM_SIM_FAT_LIB = join(NYM_SIM_FAT_DIR, SHIM_LIB); -const NYM_XCFRAMEWORK_OUT = join(REPO_IOS_DIR, 'ZingoNymProxyFFI.xcframework'); +const NYM_SIM_FAT_LIB = join(NYM_SIM_FAT_DIR, PROXY_LIB); +const PROXY_XCFRAMEWORK_OUT = join(REPO_IOS_DIR, 'MixnetProxy.xcframework'); for (const target of [DEVICE_TARGET, ...SIM_TARGETS]) { - run('cargo', ['build', '--release', '--target', target, '-p', 'zingo-nym-proxy-ffi'], { env, cwd: NYM_DIR }); + run('cargo', ['build', '--release', '--target', target, '-p', 'mixnet-proxy'], { env, cwd: PROXY_DIR }); } rmSync(NYM_GENERATED, { recursive: true, force: true }); @@ -113,24 +113,24 @@ run('cargo', [ mkdirSync(NYM_SIM_FAT_DIR, { recursive: true }); run('lipo', [ '-create', - join(NYM_TARGET_DIR, 'aarch64-apple-ios-sim', 'release', SHIM_LIB), - join(NYM_TARGET_DIR, 'x86_64-apple-ios', 'release', SHIM_LIB), + join(NYM_TARGET_DIR, 'aarch64-apple-ios-sim', 'release', PROXY_LIB), + join(NYM_TARGET_DIR, 'x86_64-apple-ios', 'release', PROXY_LIB), '-output', NYM_SIM_FAT_LIB, ]); // 5. Headers for the wallet xcframework: both FFI headers plus ONE module map // declaring both modules. Two static-library xcframeworks each shipping // Headers/module.modulemap would both copy to $BUILT_PRODUCTS_DIR/include/ -// module.modulemap ("Multiple commands produce"), so the shim rides here and +// module.modulemap ("Multiple commands produce"), so the proxy rides here and // its own xcframework ships libraries only (step 7). rmSync(XCF_HEADERS_DIR, { recursive: true, force: true }); mkdirSync(XCF_HEADERS_DIR, { recursive: true }); const generated = join(LIB_DIR, 'Generated'); copyFileSync(join(generated, 'zingoFFI.h'), join(XCF_HEADERS_DIR, 'zingoFFI.h')); -copyFileSync(join(NYM_GENERATED, 'zingo_nym_proxy_ffiFFI.h'), join(XCF_HEADERS_DIR, 'zingo_nym_proxy_ffiFFI.h')); +copyFileSync(join(NYM_GENERATED, 'mixnet_proxyFFI.h'), join(XCF_HEADERS_DIR, 'mixnet_proxyFFI.h')); const combinedModulemap = readFileSync(join(generated, 'zingoFFI.modulemap'), 'utf8') + '\n' + - readFileSync(join(NYM_GENERATED, 'zingo_nym_proxy_ffiFFI.modulemap'), 'utf8'); + readFileSync(join(NYM_GENERATED, 'mixnet_proxyFFI.modulemap'), 'utf8'); writeFileSync(join(XCF_HEADERS_DIR, 'module.modulemap'), combinedModulemap); // 6. Wallet xcframework carries both headers + the combined module map. @@ -144,20 +144,20 @@ run('xcodebuild', [ '-output', XCFRAMEWORK_OUT, ]); -// 7. Shim xcframework: libraries only. Its headers/module live in the wallet +// 7. Proxy xcframework: libraries only. Its headers/module live in the wallet // xcframework above, so nothing here writes a second include/module.modulemap. -if (existsSync(NYM_XCFRAMEWORK_OUT)) { - rmSync(NYM_XCFRAMEWORK_OUT, { recursive: true, force: true }); +if (existsSync(PROXY_XCFRAMEWORK_OUT)) { + rmSync(PROXY_XCFRAMEWORK_OUT, { recursive: true, force: true }); } run('xcodebuild', [ '-create-xcframework', '-library', NYM_DEVICE_LIB, '-library', NYM_SIM_FAT_LIB, - '-output', NYM_XCFRAMEWORK_OUT, + '-output', PROXY_XCFRAMEWORK_OUT, ]); // 8. Copy both Swift bindings to the app (compiled as normal Swift sources). copyFileSync(join(generated, 'zingo.swift'), join(REPO_IOS_DIR, 'zingo.swift')); -copyFileSync(join(NYM_GENERATED, 'zingo_nym_proxy_ffi.swift'), join(REPO_IOS_DIR, 'zingo_nym_proxy_ffi.swift')); +copyFileSync(join(NYM_GENERATED, 'mixnet_proxy.swift'), join(REPO_IOS_DIR, 'mixnet_proxy.swift')); -console.log(`\nDone. XCFrameworks at ${XCFRAMEWORK_OUT} + ${NYM_XCFRAMEWORK_OUT}`); +console.log(`\nDone. XCFrameworks at ${XCFRAMEWORK_OUT} + ${PROXY_XCFRAMEWORK_OUT}`); diff --git a/rust/lib/src/lib.rs b/rust/lib/src/lib.rs index e0554ea95..30d04d474 100644 --- a/rust/lib/src/lib.rs +++ b/rust/lib/src/lib.rs @@ -3405,13 +3405,13 @@ fn mixnet_indicator_string(indicator: zingolib::mixnet::Indicator) -> &'static s } /// Attach Mixnet Mode to an already-running, platform-hosted SOCKS5 endpoint -/// (the UniFFI proxy shim's address) that bound `exit_node`. Readiness is +/// (the mixnet proxy's address) that bound `exit_node`. Readiness is /// validated by a data round trip; poll [`mixnet_indicator`] for /// `bootstrapping` -> `ready`, or `died`. pub fn attach_mixnet(socks5_addr: String, exit_node: String) -> Result { with_panic_guard(|| { let exit = zingolib::mixnet::ExitNodeId::parse(&exit_node) - .map_err(|_| ZingolibError::Mixnet("the shim reported no exit node".to_string()))?; + .map_err(|_| ZingolibError::Mixnet("the proxy reported no exit node".to_string()))?; let mut guard = LIGHTCLIENT .write() .map_err(|_| ZingolibError::LightclientLockPoisoned)?; diff --git a/rust/nym-proxy-ffi/Cargo.lock b/rust/mixnet-proxy/Cargo.lock similarity index 99% rename from rust/nym-proxy-ffi/Cargo.lock rename to rust/mixnet-proxy/Cargo.lock index abe2159e8..ea70a0521 100644 --- a/rust/nym-proxy-ffi/Cargo.lock +++ b/rust/mixnet-proxy/Cargo.lock @@ -3513,6 +3513,20 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "mixnet-proxy" +version = "0.1.0" +dependencies = [ + "android_logger", + "log", + "thiserror 2.0.20", + "tokio", + "tracing", + "tracing-subscriber", + "uniffi", + "zingo-netutils", +] + [[package]] name = "ml-dsa" version = "0.1.1" @@ -9130,20 +9144,6 @@ dependencies = [ "zingo-net-diag", ] -[[package]] -name = "zingo-nym-proxy-ffi" -version = "0.1.0" -dependencies = [ - "android_logger", - "log", - "thiserror 2.0.20", - "tokio", - "tracing", - "tracing-subscriber", - "uniffi", - "zingo-netutils", -] - [[package]] name = "zmij" version = "1.0.23" diff --git a/rust/nym-proxy-ffi/Cargo.toml b/rust/mixnet-proxy/Cargo.toml similarity index 88% rename from rust/nym-proxy-ffi/Cargo.toml rename to rust/mixnet-proxy/Cargo.toml index 2bf46364d..de3ccdcb5 100644 --- a/rust/nym-proxy-ffi/Cargo.toml +++ b/rust/mixnet-proxy/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "zingo-nym-proxy-ffi" +name = "mixnet-proxy" version = "0.1.0" edition = "2024" -description = "UniFFI shim hosting the Nym mixnet SOCKS5 proxy for mobile (ADR 0011, CP-3)." +description = "UniFFI component hosting the Nym mixnet SOCKS5 proxy for mobile (ADR 0011, CP-3)." # The mobile host loads this as a dynamic library (cdylib for the loaded # framework) or links it statically (staticlib for the iOS XCFramework slices). @@ -11,14 +11,14 @@ description = "UniFFI shim hosting the Nym mixnet SOCKS5 proxy for mobile (ADR 0 crate-type = ["lib", "cdylib", "staticlib"] [dependencies] -# NymProxy lives here, behind the nym feature; this shim always needs it. +# NymProxy lives here, behind the nym feature; this crate always needs it. zingo-netutils = { git = "https://github.com/zingolabs/zingolib", branch = "dev", features = [ "nym", ] } # Proc-macro scaffolding (setup_scaffolding! + #[uniffi::export]); no build.rs # and no UDL. Generating the Swift/Kotlin bindings is a later, separate step. uniffi = "0.28" -# The shim owns a long-lived runtime that keeps the NymProxy client and its +# The proxy owns a long-lived runtime that keeps the NymProxy client and its # SOCKS5 listener alive across start and stop. tokio = { version = "1", features = ["io-util", "net", "rt-multi-thread", "time"] } thiserror = "2" diff --git a/rust/nym-proxy-ffi/README.md b/rust/mixnet-proxy/README.md similarity index 78% rename from rust/nym-proxy-ffi/README.md rename to rust/mixnet-proxy/README.md index 8ab09fa6a..8dfd90322 100644 --- a/rust/nym-proxy-ffi/README.md +++ b/rust/mixnet-proxy/README.md @@ -1,4 +1,4 @@ -# zingo-nym-proxy-ffi +# mixnet-proxy The Nym mixnet proxy as a UniFFI library for the mobile app. @@ -7,7 +7,7 @@ root workspace in `rust/` excludes it. ## Crates -- `zingo-nym-proxy-ffi` (`src/lib.rs`): wraps `NymProxy` from zingolib's +- `mixnet-proxy` (`src/lib.rs`): wraps `NymProxy` from zingolib's `zingo-netutils`. `MixnetProxyHandle::start` joins the Nym network and opens a local SOCKS5 listener. `socks5_endpoint` and `exit_node` report what it bound. `stop` tears it down. A listener monitor calls @@ -17,10 +17,10 @@ root workspace in `rust/` excludes it. ## Consumers - Android: `android/app/src/main/java/org/ZingoLabs/Zingo/NymTransportModule.kt` - loads `libzingo_nym_proxy_ffi.so` through the generated Kotlin bindings + loads `libmixnet_proxy.so` through the generated Kotlin bindings (`scripts/generate_kotlin_bindings.mjs`, not checked in). - `rust/workbench` has `bundle-android-shim` and `consume-android-shim`. -- iOS: `ios/NymTransportModule.swift` links `ZingoNymProxyFFI.xcframework` + `rust/workbench` has `bundle-android-proxy` and `consume-android-proxy`. +- iOS: `ios/NymTransportModule.swift` links `MixnetProxy.xcframework` and the generated Swift bindings. `rust/ios/build_ios.mjs` builds both. - The app hands the endpoint to the wallet FFI's `attachMixnet`. diff --git a/rust/nym-proxy-ffi/contract-tests/README.md b/rust/mixnet-proxy/contract-tests/README.md similarity index 100% rename from rust/nym-proxy-ffi/contract-tests/README.md rename to rust/mixnet-proxy/contract-tests/README.md diff --git a/rust/nym-proxy-ffi/contract-tests/kotlin/GoldenWireContractTest.kt b/rust/mixnet-proxy/contract-tests/kotlin/GoldenWireContractTest.kt similarity index 92% rename from rust/nym-proxy-ffi/contract-tests/kotlin/GoldenWireContractTest.kt rename to rust/mixnet-proxy/contract-tests/kotlin/GoldenWireContractTest.kt index 8f82d33c7..dcb7790e9 100644 --- a/rust/nym-proxy-ffi/contract-tests/kotlin/GoldenWireContractTest.kt +++ b/rust/mixnet-proxy/contract-tests/kotlin/GoldenWireContractTest.kt @@ -7,24 +7,24 @@ // test-data/golden/ are never-regenerate contract artifacts. // // Execution: this file compiles against the generated bindings -// (uniffi.zingo_nym_proxy_ffi) and JUnit 4; zingo-mobile's test suite wires +// (uniffi.mixnet_proxy) and JUnit 4; zingo-mobile's test suite wires // it in during step-4/step-3 packaging (#2513/#2505). Point // -Dzingo.golden.dir at the crate's test-data/golden directory if the // working directory is not the crate root. -package uniffi.zingo_nym_proxy_ffi.contract +package uniffi.mixnet_proxy.contract import java.io.File import java.nio.ByteBuffer import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Test -import uniffi.zingo_nym_proxy_ffi.FfiConverterTypeProxyDeathReason -import uniffi.zingo_nym_proxy_ffi.FfiConverterTypeProxyFfiError -import uniffi.zingo_nym_proxy_ffi.FfiConverterTypeSocks5Endpoint -import uniffi.zingo_nym_proxy_ffi.ProxyDeathReason -import uniffi.zingo_nym_proxy_ffi.ProxyFfiException -import uniffi.zingo_nym_proxy_ffi.Socks5Endpoint +import uniffi.mixnet_proxy.FfiConverterTypeProxyDeathReason +import uniffi.mixnet_proxy.FfiConverterTypeProxyFfiError +import uniffi.mixnet_proxy.FfiConverterTypeSocks5Endpoint +import uniffi.mixnet_proxy.ProxyDeathReason +import uniffi.mixnet_proxy.ProxyFfiException +import uniffi.mixnet_proxy.Socks5Endpoint class GoldenWireContractTest { private val goldenDir = File(System.getProperty("zingo.golden.dir") ?: "test-data/golden") diff --git a/rust/nym-proxy-ffi/contract-tests/swift/GoldenWireContractTests.swift b/rust/mixnet-proxy/contract-tests/swift/GoldenWireContractTests.swift similarity index 100% rename from rust/nym-proxy-ffi/contract-tests/swift/GoldenWireContractTests.swift rename to rust/mixnet-proxy/contract-tests/swift/GoldenWireContractTests.swift diff --git a/rust/nym-proxy-ffi/src/debug_log.rs b/rust/mixnet-proxy/src/debug_log.rs similarity index 100% rename from rust/nym-proxy-ffi/src/debug_log.rs rename to rust/mixnet-proxy/src/debug_log.rs diff --git a/rust/nym-proxy-ffi/src/lib.rs b/rust/mixnet-proxy/src/lib.rs similarity index 99% rename from rust/nym-proxy-ffi/src/lib.rs rename to rust/mixnet-proxy/src/lib.rs index a331a699b..0d1491821 100644 --- a/rust/nym-proxy-ffi/src/lib.rs +++ b/rust/mixnet-proxy/src/lib.rs @@ -14,7 +14,7 @@ //! preserve `#![forbid(unsafe_code)]`: uniffi's proc-macros generate the FFI //! `unsafe` scaffolding with macro hygiene that the lint does not fire on, //! while any hand-written `unsafe` in this crate would still be rejected. So -//! this shim carries zero hand-written unsafe and keeps the workspace-wide +//! this crate carries zero hand-written unsafe and keeps the workspace-wide //! safety invariant intact — see the ADR amendment for the empirical check. #![forbid(unsafe_code)] diff --git a/rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_check_timed_out.hex b/rust/mixnet-proxy/test-data/golden/proxy_death_reason_check_timed_out.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_check_timed_out.hex rename to rust/mixnet-proxy/test-data/golden/proxy_death_reason_check_timed_out.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_greeting_unwritable.hex b/rust/mixnet-proxy/test-data/golden/proxy_death_reason_greeting_unwritable.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_greeting_unwritable.hex rename to rust/mixnet-proxy/test-data/golden/proxy_death_reason_greeting_unwritable.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_listener_refused.hex b/rust/mixnet-proxy/test-data/golden/proxy_death_reason_listener_refused.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_listener_refused.hex rename to rust/mixnet-proxy/test-data/golden/proxy_death_reason_listener_refused.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_method_selection_refused.hex b/rust/mixnet-proxy/test-data/golden/proxy_death_reason_method_selection_refused.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_method_selection_refused.hex rename to rust/mixnet-proxy/test-data/golden/proxy_death_reason_method_selection_refused.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_method_selection_unreadable.hex b/rust/mixnet-proxy/test-data/golden/proxy_death_reason_method_selection_unreadable.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/proxy_death_reason_method_selection_unreadable.hex rename to rust/mixnet-proxy/test-data/golden/proxy_death_reason_method_selection_unreadable.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/proxy_ffi_error_connect.hex b/rust/mixnet-proxy/test-data/golden/proxy_ffi_error_connect.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/proxy_ffi_error_connect.hex rename to rust/mixnet-proxy/test-data/golden/proxy_ffi_error_connect.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/proxy_ffi_error_runtime.hex b/rust/mixnet-proxy/test-data/golden/proxy_ffi_error_runtime.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/proxy_ffi_error_runtime.hex rename to rust/mixnet-proxy/test-data/golden/proxy_ffi_error_runtime.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/socks5_endpoint.hex b/rust/mixnet-proxy/test-data/golden/socks5_endpoint.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/socks5_endpoint.hex rename to rust/mixnet-proxy/test-data/golden/socks5_endpoint.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/socks5_endpoint_port_max.hex b/rust/mixnet-proxy/test-data/golden/socks5_endpoint_port_max.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/socks5_endpoint_port_max.hex rename to rust/mixnet-proxy/test-data/golden/socks5_endpoint_port_max.hex diff --git a/rust/nym-proxy-ffi/test-data/golden/socks5_endpoint_port_min.hex b/rust/mixnet-proxy/test-data/golden/socks5_endpoint_port_min.hex similarity index 100% rename from rust/nym-proxy-ffi/test-data/golden/socks5_endpoint_port_min.hex rename to rust/mixnet-proxy/test-data/golden/socks5_endpoint_port_min.hex diff --git a/rust/nym-proxy-ffi/tests/ffi_roundtrip.rs b/rust/mixnet-proxy/tests/ffi_roundtrip.rs similarity index 96% rename from rust/nym-proxy-ffi/tests/ffi_roundtrip.rs rename to rust/mixnet-proxy/tests/ffi_roundtrip.rs index 98b9e3c05..4c1b6b636 100644 --- a/rust/nym-proxy-ffi/tests/ffi_roundtrip.rs +++ b/rust/mixnet-proxy/tests/ffi_roundtrip.rs @@ -6,8 +6,8 @@ //! coherence the host-language bindings depend on — in safe Rust, hermetically. //! Live start/stop semantics stay on the device-smoke rung (#2507). +use mixnet_proxy::{ProxyDeathReason, ProxyFfiError, Socks5Endpoint, UniFfiTag}; use uniffi::{Lift, Lower}; -use zingo_nym_proxy_ffi::{ProxyDeathReason, ProxyFfiError, Socks5Endpoint, UniFfiTag}; /// Send `value` through the wire encoding both directions and hand back what /// the far side would see. diff --git a/rust/nym-proxy-ffi/tests/golden_wire.rs b/rust/mixnet-proxy/tests/golden_wire.rs similarity index 98% rename from rust/nym-proxy-ffi/tests/golden_wire.rs rename to rust/mixnet-proxy/tests/golden_wire.rs index 9311ffb41..4a482cfe8 100644 --- a/rust/nym-proxy-ffi/tests/golden_wire.rs +++ b/rust/mixnet-proxy/tests/golden_wire.rs @@ -19,8 +19,8 @@ use std::{fs, path::PathBuf}; +use mixnet_proxy::{ProxyDeathReason, ProxyFfiError, Socks5Endpoint, UniFfiTag}; use uniffi::{Lift, Lower}; -use zingo_nym_proxy_ffi::{ProxyDeathReason, ProxyFfiError, Socks5Endpoint, UniFfiTag}; /// The canonical endpoint values, shared verbatim with the Kotlin and Swift /// suites, changed only together with all three suites while minting new diff --git a/rust/nym-proxy-ffi/tests/live_mixnet.rs b/rust/mixnet-proxy/tests/live_mixnet.rs similarity index 95% rename from rust/nym-proxy-ffi/tests/live_mixnet.rs rename to rust/mixnet-proxy/tests/live_mixnet.rs index 8c5d7f885..2cb9b9fbb 100644 --- a/rust/nym-proxy-ffi/tests/live_mixnet.rs +++ b/rust/mixnet-proxy/tests/live_mixnet.rs @@ -11,10 +11,8 @@ use std::{ time::Duration, }; +use mixnet_proxy::{MixnetProxyHandle, ProxyDeathObserver, ProxyDeathReason, Socks5Endpoint}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; -use zingo_nym_proxy_ffi::{ - MixnetProxyHandle, ProxyDeathObserver, ProxyDeathReason, Socks5Endpoint, -}; /// The wall-clock budget for bringing up a proxy against the live mixnet. const START_BOUND: Duration = Duration::from_secs(180); diff --git a/rust/nym-proxy-ffi/uniffi.toml b/rust/mixnet-proxy/uniffi.toml similarity index 100% rename from rust/nym-proxy-ffi/uniffi.toml rename to rust/mixnet-proxy/uniffi.toml diff --git a/rust/uniffi-bindgen/Cargo.toml b/rust/uniffi-bindgen/Cargo.toml index 89ef00046..9f0f5ce3d 100644 --- a/rust/uniffi-bindgen/Cargo.toml +++ b/rust/uniffi-bindgen/Cargo.toml @@ -2,7 +2,7 @@ name = "zingo-uniffi-bindgen" version = "0.1.0" edition = "2024" -description = "Project-local uniffi-bindgen binaries for the wallet and the Nym proxy shim." +description = "Project-local uniffi-bindgen binaries for the wallet and the mixnet proxy." publish = false # Two binaries, one per uniffi version in this repository. Each generates the @@ -16,7 +16,7 @@ name = "zingo-wallet-uniffi-bindgen" path = "src/bin/zingo-wallet-uniffi-bindgen.rs" [dependencies] -# The shim's version (`zingo-nym-proxy-ffi`, rust/nym-proxy-ffi). -uniffi_shim = { package = "uniffi", version = "0.28", features = ["cli"] } +# The proxy's version (`mixnet-proxy`, rust/mixnet-proxy). +uniffi_proxy = { package = "uniffi", version = "0.28", features = ["cli"] } # The wallet's version (`zingo`, rust/lib). Keep equal to the workspace `uniffi` pin. uniffi_wallet = { package = "uniffi", version = "0.29", features = ["cli"] } diff --git a/rust/uniffi-bindgen/src/bin/zingo-uniffi-bindgen.rs b/rust/uniffi-bindgen/src/bin/zingo-uniffi-bindgen.rs index 6c43e4767..22888b045 100644 --- a/rust/uniffi-bindgen/src/bin/zingo-uniffi-bindgen.rs +++ b/rust/uniffi-bindgen/src/bin/zingo-uniffi-bindgen.rs @@ -1,19 +1,19 @@ #![forbid(unsafe_code)] -//! Project-local `uniffi-bindgen` for the Nym proxy shim, pinned to the -//! `uniffi` version `zingo-nym-proxy-ffi` compiles against. Run it in library -//! mode against a built shim library. Library mode reads the UniFFI metadata +//! Project-local `uniffi-bindgen` for the mixnet proxy, pinned to the +//! `uniffi` version `mixnet-proxy` compiles against. Run it in library +//! mode against a built proxy library. Library mode reads the UniFFI metadata //! statically, so a cross-compiled Android `.so` works on the host: //! //! ```text //! cargo run --package zingo-uniffi-bindgen --bin zingo-uniffi-bindgen -- \ -//! generate --library /libzingo_nym_proxy_ffi.so \ +//! generate --library /libmixnet_proxy.so \ //! --language kotlin --out-dir //! ``` //! -//! `scripts/generate_kotlin_bindings.mjs` and `consume-android-shim` (the +//! `scripts/generate_kotlin_bindings.mjs` and `consume-android-proxy` (the //! workbench crate) drive it. fn main() { - uniffi_shim::uniffi_bindgen_main() + uniffi_proxy::uniffi_bindgen_main() } diff --git a/rust/workbench/src/bin/bundle-android-shim.rs b/rust/workbench/src/bin/bundle-android-proxy.rs similarity index 78% rename from rust/workbench/src/bin/bundle-android-shim.rs rename to rust/workbench/src/bin/bundle-android-proxy.rs index b412dab47..05951a198 100644 --- a/rust/workbench/src/bin/bundle-android-shim.rs +++ b/rust/workbench/src/bin/bundle-android-proxy.rs @@ -1,21 +1,21 @@ -//! Cross-compile the mixnet proxy shim for Android and lay out its package. +//! Cross-compile the mixnet proxy for Android and lay out its package. //! -//! The shim (`zingo-nym-proxy-ffi`, ADR 0011 mobile amendment) lives at -//! `rust/nym-proxy-ffi`, excluded from the workspace with its own lockfile, so ordinary wallet +//! The proxy (`mixnet-proxy`, ADR 0011 mobile amendment) lives at +//! `rust/mixnet-proxy`, excluded from the workspace with its own lockfile, so ordinary wallet //! builds never produce it (nym-sdk's `crypto-common` cannot share the wallet //! lock). This tool release-builds it with cargo-ndk for every Android ABI //! zingo-mobile ships (`reactNativeArchitectures` in `android/gradle.properties`) //! and lays out: //! //! ```text -//! /jniLibs//libzingo_nym_proxy_ffi.so (one per ABI) +//! /jniLibs//libmixnet_proxy.so (one per ABI) //! ``` //! -//! `consume-android-shim` stages that tree into the app and regenerates the +//! `consume-android-proxy` stages that tree into the app and regenerates the //! Kotlin bindings (library mode against a staged `.so`), so this tool never -//! needs a host cdylib. Usage: `bundle-android-shim [--abi ]… [--dest +//! needs a host cdylib. Usage: `bundle-android-proxy [--abi ]… [--dest //! ]`. Without `--abi` every shipped ABI is built; without `--dest` the -//! tree lands in `rust/nym-proxy-ffi/target/android-shim`. Requires cargo-ndk, an +//! tree lands in `rust/mixnet-proxy/target/android-proxy`. Requires cargo-ndk, an //! NDK, and the matching `rustup target`s. #![forbid(unsafe_code)] @@ -33,12 +33,12 @@ const SHIPPED_ABIS: [(&str, &str); 4] = [ ("x86_64", "x86_64-linux-android"), ]; -const SHIM_SO: &str = "libzingo_nym_proxy_ffi.so"; +const PROXY_SO: &str = "libmixnet_proxy.so"; fn main() { let args: Vec = std::env::args().skip(1).collect(); run( - "bundle-android-shim", + "bundle-android-proxy", || bundle(&args), |dest| println!("{}", dest.display()), ) @@ -49,35 +49,35 @@ fn main() { fn bundle(args: &[String]) -> Result> { let abis = requested_abis(args)?; let root = repo_root()?; - let shim_workspace = root.join("rust/nym-proxy-ffi"); - let dest = parse_dest(args)?.unwrap_or_else(|| shim_workspace.join("target/android-shim")); + let proxy_workspace = root.join("rust/mixnet-proxy"); + let dest = parse_dest(args)?.unwrap_or_else(|| proxy_workspace.join("target/android-proxy")); for (abi, triple) in &abis { let status = Command::new("cargo") - .current_dir(&shim_workspace) + .current_dir(&proxy_workspace) .args(["ndk", "-t", abi, "build", "--release"]) - .args(["--package", "zingo-nym-proxy-ffi"]) + .args(["--package", "mixnet-proxy"]) .status() .map_err(|e| vec![format!("failed to run cargo ndk: {e}")])?; if !status.success() { return Err(vec![format!("cargo ndk build for {abi} failed ({status})")]); } - let source = shim_workspace + let source = proxy_workspace .join("target") .join(triple) .join("release") - .join(SHIM_SO); + .join(PROXY_SO); if !source.is_file() { return Err(vec![format!( - "built {abi} shim missing at {}", + "built {abi} proxy missing at {}", source.display() )]); } let abi_dir = dest.join("jniLibs").join(abi); std::fs::create_dir_all(&abi_dir) .map_err(|e| vec![format!("cannot create {}: {e}", abi_dir.display())])?; - std::fs::copy(&source, abi_dir.join(SHIM_SO)) - .map_err(|e| vec![format!("cannot copy {abi} shim: {e}")])?; + std::fs::copy(&source, abi_dir.join(PROXY_SO)) + .map_err(|e| vec![format!("cannot copy {abi} library: {e}")])?; } Ok(dest) diff --git a/rust/workbench/src/bin/consume-android-shim.rs b/rust/workbench/src/bin/consume-android-proxy.rs similarity index 79% rename from rust/workbench/src/bin/consume-android-shim.rs rename to rust/workbench/src/bin/consume-android-proxy.rs index b61c33a90..2ea35bdb6 100644 --- a/rust/workbench/src/bin/consume-android-shim.rs +++ b/rust/workbench/src/bin/consume-android-proxy.rs @@ -1,13 +1,13 @@ #![forbid(unsafe_code)] -//! consume-android-shim: stage the Nym proxy shim bundle into the app. +//! consume-android-proxy: stage the mixnet proxy bundle into the app. //! -//! zingolib's `makers bundle-android-shim` (its workbench crate) cross-compiles -//! the UniFFI proxy shim `zingo-nym-proxy-ffi` for every shipped ABI and lays +//! zingolib's `makers bundle-android-proxy` (its workbench crate) cross-compiles +//! the mixnet proxy `mixnet-proxy` for every shipped ABI and lays //! out a bundle tree: //! //! ```text -//! /jniLibs//libzingo_nym_proxy_ffi.so (one per ABI) +//! /jniLibs//libmixnet_proxy.so (one per ABI) //! ``` //! //! This tool consumes that tree (send-over-nym step 3, zingolib#2513): @@ -17,13 +17,13 @@ //! like the wallet's `libuniffi_zingo.so`. //! - The Kotlin bindings are not staged here. `scripts/generate_kotlin_bindings.mjs` //! generates them into `android/app/build/generated/source/uniffi/` from an -//! unstripped shim library; pass the bundle's `.so` with `--shim-library`. +//! unstripped proxy library; pass the bundle's `.so` with `--proxy-library`. //! //! A `kotlin/` tree in the bundle (produced by older zingolib versions that //! generated bindings on their side) is ignored. //! -//! Usage: `cargo run -p workbench --bin consume-android-shim -- --bundle ` -//! where `` is the bundle root (zingolib's `target/android-shim` by +//! Usage: `cargo run -p workbench --bin consume-android-proxy -- --bundle ` +//! where `` is the bundle root (zingolib's `target/android-proxy` by //! default on that side). A bundle built with a subset of ABIs (via that //! tool's `--abi`) stages only what it carries; missing ABIs are reported. @@ -31,10 +31,10 @@ use std::path::{Path, PathBuf}; /// The ABIs zingo-mobile ships (`reactNativeArchitectures` in /// `android/gradle.properties`), which must stay in step with -/// `bundle-android-shim`'s `SHIPPED_ABIS`. +/// `bundle-android-proxy`'s `SHIPPED_ABIS`. const SHIPPED_ABIS: [&str; 4] = ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"]; -const SHIM_SO: &str = "libzingo_nym_proxy_ffi.so"; +const PROXY_SO: &str = "libmixnet_proxy.so"; /// Which shipped ABIs a bundle tree carries and which it lacks, computed /// purely so the partition is unit-testable without a real bundle on disk. @@ -76,11 +76,11 @@ fn stage(bundle: &Path) -> Result<(), String> { let root = repo_root(); let (present, missing) = - partition_abis(|abi| bundle.join("jniLibs").join(abi).join(SHIM_SO).is_file()); + partition_abis(|abi| bundle.join("jniLibs").join(abi).join(PROXY_SO).is_file()); if present.is_empty() { return Err(format!( - "no {SHIM_SO} for any shipped ABI under {}/jniLibs; \ - run zingolib's `makers bundle-android-shim` first", + "no {PROXY_SO} for any shipped ABI under {}/jniLibs; \ + run zingolib's `makers bundle-android-proxy` first", bundle.display() )); } @@ -88,13 +88,13 @@ fn stage(bundle: &Path) -> Result<(), String> { let target_dir = root.join("android/app/src/main/jniLibs").join(abi); std::fs::create_dir_all(&target_dir) .map_err(|e| format!("cannot create {}: {e}", target_dir.display()))?; - let source = bundle.join("jniLibs").join(abi).join(SHIM_SO); - std::fs::copy(&source, target_dir.join(SHIM_SO)) + let source = bundle.join("jniLibs").join(abi).join(PROXY_SO); + std::fs::copy(&source, target_dir.join(PROXY_SO)) .map_err(|e| format!("cannot copy {}: {e}", source.display()))?; - println!("staged {abi}/{SHIM_SO}"); + println!("staged {abi}/{PROXY_SO}"); } for abi in &missing { - println!("note: bundle carries no {abi} shim; that ABI will not embed it"); + println!("note: bundle carries no {abi} library; that ABI will not embed it"); } Ok(()) } @@ -102,7 +102,7 @@ fn stage(bundle: &Path) -> Result<(), String> { fn main() { let result = parse_bundle_arg().and_then(|bundle| stage(&bundle)); if let Err(message) = result { - eprintln!("consume-android-shim: {message}"); + eprintln!("consume-android-proxy: {message}"); std::process::exit(1); } } diff --git a/scripts/android_lint.mjs b/scripts/android_lint.mjs index 8d62ffb38..de112b3f3 100755 --- a/scripts/android_lint.mjs +++ b/scripts/android_lint.mjs @@ -20,7 +20,7 @@ const variant = process.argv[2] ?? 'prodRelease'; const task = `:app:lint${variant[0].toUpperCase()}${variant.slice(1)}`; // The app module compiles the UniFFI bindings. Generate them first. The -// shim builds for the host; no NDK. +// the proxy builds for the host; no NDK. console.log('\nGenerating UniFFI bindings...'); const generated = spawnSync( process.execPath, diff --git a/scripts/generate_kotlin_bindings.mjs b/scripts/generate_kotlin_bindings.mjs index 12ae3296c..ccbec261a 100644 --- a/scripts/generate_kotlin_bindings.mjs +++ b/scripts/generate_kotlin_bindings.mjs @@ -1,17 +1,17 @@ #!/usr/bin/env node // Generates the Android Kotlin UniFFI bindings for the wallet (rust/lib) and -// the Nym proxy shim (rust/nym-proxy-ffi) into +// the mixnet proxy (rust/mixnet-proxy) into // android/app/build/generated/source/uniffi//java, the source dir // the app module compiles. Neither binding is checked in. // -// The wallet binding comes from the UDL and needs no wallet build. The shim +// The wallet binding comes from the UDL and needs no wallet build. The proxy // binding comes from library mode, which reads the UniFFI metadata from an -// unstripped shim library: pass one with --shim-library, or this script -// builds the shim for the host. +// unstripped proxy library: pass one with --proxy-library, or this script +// builds the proxy for the host. // // Usage: node scripts/generate_kotlin_bindings.mjs // [--variants release|debug,release,...] (default: release) -// [--shim-library ] +// [--proxy-library ] import { spawnSync } from 'node:child_process'; import { existsSync, mkdirSync } from 'node:fs'; @@ -21,33 +21,33 @@ import { fileURLToPath } from 'node:url'; const SCRIPTS_DIR = dirname(fileURLToPath(import.meta.url)); const REPO_DIR = resolve(SCRIPTS_DIR, '..'); const RUST_DIR = join(REPO_DIR, 'rust'); -const SHIM_DIR = join(RUST_DIR, 'nym-proxy-ffi'); +const PROXY_DIR = join(RUST_DIR, 'mixnet-proxy'); const UDL = join(RUST_DIR, 'lib', 'src', 'zingo.udl'); const OUT_ROOT = join(REPO_DIR, 'android', 'app', 'build', 'generated', 'source', 'uniffi'); const exe = process.platform === 'win32' ? '.exe' : ''; const WALLET_BINDGEN = join(RUST_DIR, 'target', 'release', `zingo-wallet-uniffi-bindgen${exe}`); -const SHIM_BINDGEN = join(RUST_DIR, 'target', 'release', `zingo-uniffi-bindgen${exe}`); +const PROXY_BINDGEN = join(RUST_DIR, 'target', 'release', `zingo-uniffi-bindgen${exe}`); function parseArgs(argv) { let variants = ['release']; - let shimLibrary; + let proxyLibrary; for (let i = 0; i < argv.length; i++) { const flag = argv[i]; if (flag === '--variants') { variants = argv[++i].split(',').filter(Boolean); } else if (flag.startsWith('--variants=')) { variants = flag.slice('--variants='.length).split(',').filter(Boolean); - } else if (flag === '--shim-library') { - shimLibrary = resolve(argv[++i]); - } else if (flag.startsWith('--shim-library=')) { - shimLibrary = resolve(flag.slice('--shim-library='.length)); + } else if (flag === '--proxy-library') { + proxyLibrary = resolve(argv[++i]); + } else if (flag.startsWith('--proxy-library=')) { + proxyLibrary = resolve(flag.slice('--proxy-library='.length)); } else { console.error(`unknown flag: ${flag}`); process.exit(2); } } - return { variants, shimLibrary }; + return { variants, proxyLibrary }; } function run(cmd, args, cwd) { @@ -58,29 +58,29 @@ function run(cmd, args, cwd) { } } -function hostShimLibrary() { +function hostProxyLibrary() { const name = process.platform === 'win32' - ? 'zingo_nym_proxy_ffi.dll' + ? 'mixnet_proxy.dll' : process.platform === 'darwin' - ? 'libzingo_nym_proxy_ffi.dylib' - : 'libzingo_nym_proxy_ffi.so'; - return join(SHIM_DIR, 'target', 'debug', name); + ? 'libmixnet_proxy.dylib' + : 'libmixnet_proxy.so'; + return join(PROXY_DIR, 'target', 'debug', name); } -const { variants, shimLibrary } = parseArgs(process.argv.slice(2)); +const { variants, proxyLibrary } = parseArgs(process.argv.slice(2)); console.log('=== Building the bindgen binaries ==='); run('cargo', ['build', '--release', '--locked', '--package', 'zingo-uniffi-bindgen'], RUST_DIR); -let shimLib = shimLibrary; -if (shimLib === undefined) { - console.log('=== Building the Nym proxy shim for the host ==='); - run('cargo', ['build', '--locked', '--package', 'zingo-nym-proxy-ffi'], SHIM_DIR); - shimLib = hostShimLibrary(); +let proxyLib = proxyLibrary; +if (proxyLib === undefined) { + console.log('=== Building the mixnet proxy for the host ==='); + run('cargo', ['build', '--locked', '--package', 'mixnet-proxy'], PROXY_DIR); + proxyLib = hostProxyLibrary(); } -if (!existsSync(shimLib)) { - console.error(`shim library not found: ${shimLib}`); +if (!existsSync(proxyLib)) { + console.error(`proxy library not found: ${proxyLib}`); process.exit(1); } @@ -93,14 +93,14 @@ for (const variant of variants) { ['generate', UDL, '--language', 'kotlin', '--no-format', '--out-dir', outDir], RUST_DIR, ); - // Library mode resolves the crate through `cargo metadata` in the shim's + // Library mode resolves the crate through `cargo metadata` in the proxy's // own workspace. `--metadata-no-deps` keeps that offline. run( - SHIM_BINDGEN, + PROXY_BINDGEN, [ 'generate', '--library', - shimLib, + proxyLib, '--language', 'kotlin', '--no-format', @@ -108,6 +108,6 @@ for (const variant of variants) { '--out-dir', outDir, ], - SHIM_DIR, + PROXY_DIR, ); }