diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3531ffd5..78da517d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -36,7 +36,7 @@ Closes # - [ ] Commits follow [Conventional Commits](https://www.conventionalcommits.org/) (`(): `) - [ ] Docs / `CHANGELOG.md` updated where relevant - [ ] No new `unsafe` in core crates (only the `offline-protocol-uniffi` FFI boundary may use it, with SAFETY comments) -- [ ] If the UniFFI UDL changed, bindings were regenerated (`./scripts/generate-bindings.sh`) and **all three** — Swift, Kotlin, Python — committed together; a partial set fails at runtime, not build time +- [ ] If the UniFFI UDL changed, bindings were regenerated (`./scripts/generate-bindings.sh`) and **all four** — Swift, Kotlin, Python, Java — committed together; a partial set fails at runtime, not build time ## Breaking changes diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 018c7e5d..4e1add73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -571,6 +571,49 @@ jobs: shell: bash run: bash scripts/check-c-library.sh windows-x86_64 target/debug + # The Java binding (docs/bridges/java.md). Its sources are generated from the + # UDL and their drift is gated with the other bindings (python-bindings). This + # is the other side: the generated Java, compiled and run against the + # library built from the same definition. The generated code verifies the + # library's FFI checksums before the first call, so the tests fail if the two + # were produced from different definitions. JDK 22 or later is required for + # the foreign function API; Gradle 8.9 cannot run on it, hence 9.x here. + java-binding: + name: Java Binding (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v7 + + - uses: dtolnay/rust-toolchain@stable + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: ci-java-binding + + - uses: actions/setup-java@v6 + with: + distribution: temurin + java-version: "25" + + - uses: gradle/actions/setup-gradle@v6 + with: + gradle-version: "9.3.1" + + - name: Build the library + run: cargo build --locked --package offline-protocol-uniffi + + # Compiles the committed generated sources, runs the consumer check + # against the library built above, and builds the Javadoc and sources jars, + # then writes the Maven repository the release signs, so a POM or + # publication error shows on the pull request and not on a tag. + - name: Build and test the Java binding + working-directory: bindings/java + run: gradle --no-daemon --stacktrace build publishAllPublicationsToStagingRepository + security: name: Dependency Audit runs-on: ubuntu-latest @@ -629,6 +672,11 @@ jobs: - name: Install uniffi-bindgen run: cargo install uniffi --version 0.32.2 --features cli --locked --force + # Versioned apart from uniffi; the 0.5 series generates for UniFFI 0.32. + # scripts/generate-bindings.sh fails the build if the series disagrees. + - name: Install uniffi-bindgen-java + run: cargo install uniffi-bindgen-java --version 0.5.2 --locked --force + # Delete the generated files first, so the drift gate below proves they # were *written* and not merely unchanged. `git diff --exit-code` on a # path nothing wrote to reports no diff, which makes "up to date" and @@ -645,6 +693,7 @@ jobs: rm -rf bindings/react-native/ios/Generated \ bindings/react-native/android/src/main/java/uniffi rm -f bindings/python/offline_protocol_sdk/offline_protocol.py + rm -rf bindings/java/src/main/java/com/offlineprotocol/sdk # Regenerate before building anything. Bindgen reads the UDL and nothing # else, so putting this ahead of the cdylib compile means drift surfaces @@ -653,7 +702,7 @@ jobs: - name: Regenerate all UniFFI bindings run: bash scripts/generate-bindings.sh - # One regeneration, one gate: the three files are one artifact set off one + # One regeneration, one gate: the four sets are one artifact set off one # UDL, so checking them separately would let a half-updated commit pass # the half of the gate it happened to satisfy. - name: Fail on stale bindings @@ -661,9 +710,10 @@ jobs: if ! git diff --exit-code -- \ bindings/python/offline_protocol_sdk/offline_protocol.py \ bindings/react-native/ios/Generated/ \ - bindings/react-native/android/src/main/java/uniffi/; then + bindings/react-native/android/src/main/java/uniffi/ \ + bindings/java/src/main/java/com/offlineprotocol/sdk/; then echo "::error::Committed UniFFI bindings are out of date." - echo "Run: bash scripts/generate-bindings.sh and commit all three." + echo "Run: bash scripts/generate-bindings.sh and commit all four." exit 1 fi @@ -752,12 +802,13 @@ jobs: uses: actions/cache@v6 with: path: ~/.cargo/bin/uniffi-bindgen* - key: uniffi-bindgen-${{ runner.os }}-0.32.2 + key: uniffi-bindgen-${{ runner.os }}-0.32.2-java-0.5.2 - # --force: see the Python Bindings job's install step. - - name: Install uniffi-bindgen + - name: Install uniffi-bindgen and uniffi-bindgen-java if: steps.cache-uniffi.outputs.cache-hit != 'true' - run: cargo install uniffi --version 0.32.2 --features cli --locked --force + run: | + cargo install uniffi --version 0.32.2 --features cli --locked --force + cargo install uniffi-bindgen-java --version 0.5.2 --locked --force - name: Build the desktop library and the bindings shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 52ff7a1c..a570c138 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,9 @@ env: # moved can already be in ~/.cargo/bin, and `cargo install` refuses to # overwrite a binary it does not know it installed (see ci.yml). UNIFFI_VERSION: "0.32.2" + # The community Java generator, versioned apart from uniffi. Its 0.5 series + # generates for UniFFI 0.32; scripts/generate-bindings.sh refuses another. + UNIFFI_BINDGEN_JAVA_VERSION: "0.5.2" # --------------------------------------------------------------------------- # Third-party action pinning @@ -126,12 +129,14 @@ jobs: id: cache-uniffi uses: actions/cache@v6 with: - path: ~/.cargo/bin/uniffi-bindgen - key: uniffi-bindgen-${{ runner.os }}-${{ env.UNIFFI_VERSION }} + path: ~/.cargo/bin/uniffi-bindgen* + key: uniffi-bindgen-${{ runner.os }}-${{ env.UNIFFI_VERSION }}-java-${{ env.UNIFFI_BINDGEN_JAVA_VERSION }} - - name: Install uniffi-bindgen + - name: Install uniffi-bindgen and uniffi-bindgen-java if: steps.cache-uniffi.outputs.cache-hit != 'true' - run: cargo install uniffi --version ${{ env.UNIFFI_VERSION }} --features cli --locked --force + run: | + cargo install uniffi --version ${{ env.UNIFFI_VERSION }} --features cli --locked --force + cargo install uniffi-bindgen-java --version ${{ env.UNIFFI_BINDGEN_JAVA_VERSION }} --locked --force - name: Build iOS Libraries working-directory: bindings/react-native @@ -281,12 +286,14 @@ jobs: id: cache-uniffi uses: actions/cache@v6 with: - path: ~/.cargo/bin/uniffi-bindgen - key: uniffi-bindgen-${{ runner.os }}-${{ env.UNIFFI_VERSION }} + path: ~/.cargo/bin/uniffi-bindgen* + key: uniffi-bindgen-${{ runner.os }}-${{ env.UNIFFI_VERSION }}-java-${{ env.UNIFFI_BINDGEN_JAVA_VERSION }} - - name: Install uniffi-bindgen + - name: Install uniffi-bindgen and uniffi-bindgen-java if: steps.cache-uniffi.outputs.cache-hit != 'true' - run: cargo install uniffi --version ${{ env.UNIFFI_VERSION }} --features cli --locked --force + run: | + cargo install uniffi --version ${{ env.UNIFFI_VERSION }} --features cli --locked --force + cargo install uniffi-bindgen-java --version ${{ env.UNIFFI_BINDGEN_JAVA_VERSION }} --locked --force # The Kotlin this job uploads is downloaded *over* the committed Android # bindings in the publish job, so it — not the committed file — is what @@ -530,14 +537,16 @@ jobs: id: cache-uniffi uses: actions/cache@v6 with: - path: ~/.cargo/bin/uniffi-bindgen - key: uniffi-bindgen-${{ runner.os }}-${{ env.UNIFFI_VERSION }} + path: ~/.cargo/bin/uniffi-bindgen* + key: uniffi-bindgen-${{ runner.os }}-${{ env.UNIFFI_VERSION }}-java-${{ env.UNIFFI_BINDGEN_JAVA_VERSION }} - - name: Install uniffi-bindgen + - name: Install uniffi-bindgen and uniffi-bindgen-java if: steps.cache-uniffi.outputs.cache-hit != 'true' - run: cargo install uniffi --version ${{ env.UNIFFI_VERSION }} --features cli --locked --force + run: | + cargo install uniffi --version ${{ env.UNIFFI_VERSION }} --features cli --locked --force + cargo install uniffi-bindgen-java --version ${{ env.UNIFFI_BINDGEN_JAVA_VERSION }} --locked --force - # Generates all three languages; only the Python file is uploaded here. + # Generates all four languages; only the Python file is uploaded here. # Going through the shared script keeps the released wheel's bindings # produced exactly the way CI's drift gate verified them, and picks up its # check that uniffi-bindgen agrees with the crate's uniffi pin to the @@ -787,6 +796,70 @@ jobs: path: bindings/kotlin/offline-protocol-android/build/maven/ retention-days: 1 + # The Java binding a release publishes: the committed generated sources + # (their drift is gated in ci.yml), compiled and tested against the release + # profile's native library on the JDK the foreign function API needs. + # Credential-free: it writes an unsigned Maven repository, and + # `publish-maven-java` signs what this tested. The jar holds no native code. + java-library: + name: Build Java Library + needs: [version-gate] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable + with: + toolchain: stable + + - uses: actions/setup-java@v6 + with: + distribution: temurin + java-version: "25" + + # Gradle 8.9 cannot run on JDK 25 (ci.yml's java-binding job). + - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + with: + gradle-version: "9.3.1" + + - name: Build the native library the tests load + run: cargo build --release --locked --package offline-protocol-uniffi + + - name: Test the library and write it out as a Maven repository + working-directory: bindings/java + env: + VERSION: ${{ needs.version-gate.outputs.VERSION }} + run: > + gradle --no-daemon --stacktrace -PVERSION_NAME="$VERSION" + -PnativeLibrary="$GITHUB_WORKSPACE/target/release/liboffline_protocol_uniffi.so" + build publishAllPublicationsToStagingRepository + + # Central refuses a deployment missing any of these, and the bundle script + # refuses anything else; failing here names the file before a signing key + # is involved. + - name: Check what is in the repository + env: + VERSION: ${{ needs.version-gate.outputs.VERSION }} + run: | + set -euo pipefail + DIR="bindings/java/build/maven/com/offlineprotocol/offline-protocol-java/$VERSION" + for suffix in .jar .pom .module -sources.jar -javadoc.jar; do + [ -s "$DIR/offline-protocol-java-$VERSION$suffix" ] || { + echo "::error title=Java library incomplete::offline-protocol-java-$VERSION$suffix is missing or empty." + exit 1 + } + done + unzip -l "$DIR/offline-protocol-java-$VERSION.jar" | grep -q 'META-INF/LICENSE$' || { + echo "::error title=Java library incomplete::the jar does not carry the license." + exit 1 + } + + - uses: actions/upload-artifact@v7 + with: + name: java-library-maven + path: bindings/java/build/maven/ + retention-days: 1 + # The Swift package a release publishes, built from the release's own # libraries and tested on a simulator: its suites, the bridge's, and an # application that depends on it. Assembled here with the XCFramework in @@ -1043,11 +1116,11 @@ jobs: # job alone, it splits the release across registries with no way back — see # the long note on that job. # - # The Swift package, the Android library and the wheels are in it too, and + # The Swift package, the Android and Java libraries and the wheels are in it too, and # their tests: the GitHub release carries the wheels, the Swift package and # the archive it names, and Maven Central and PyPI publish only after this # job, so one that fails its tests stops everything before npm. - needs: [version-gate, build-ios, build-android, android-bindings, build-desktop-macos, build-desktop-linux, build-desktop-windows, python-bindings, test-python, audit-python, python-package, test-python-wheels, android-library, swift-package, test-c-library] + needs: [version-gate, build-ios, build-android, android-bindings, build-desktop-macos, build-desktop-linux, build-desktop-windows, python-bindings, test-python, audit-python, python-package, test-python-wheels, android-library, java-library, swift-package, test-c-library] runs-on: ubuntu-latest permissions: contents: write @@ -1733,7 +1806,8 @@ jobs: # against the real Portal: the token, the signing key and every POM # requirement are exercised, and nothing is released. # - # MAVEN_CENTRAL_PUBLISH secrets: MAVEN_CENTRAL_USERNAME, MAVEN_CENTRAL_PASSWORD, + # MAVEN_CENTRAL_PUBLISH both the Android and the Java library; + # secrets: MAVEN_CENTRAL_USERNAME, MAVEN_CENTRAL_PASSWORD, # MAVEN_SIGNING_KEY, MAVEN_SIGNING_KEY_PASSWORD # PYPI_PUBLISH no secret: trusted publishing, environment `pypi` # @@ -1806,6 +1880,64 @@ jobs: [ "$REAL_RELEASE" = true ] && MODE=publish bash scripts/maven-central-upload.sh "$RUNNER_TEMP/central-bundle.zip" "$MODE" "$VERSION" + # com.offlineprotocol:offline-protocol-java, signed and uploaded as its own + # deployment, from the repository the `java-library` job built and tested, + # under the same switch as the Android library. Separate from `publish-maven` + # so that a refusal of one does not hold back the other; a version on Central + # is permanent, so a half-shipped release is re-run, not rolled back. + publish-maven-java: + name: Publish Java Library to Maven Central + needs: [version-gate, java-library, release] + runs-on: ubuntu-latest + env: + VERSION: ${{ needs.version-gate.outputs.VERSION }} + REAL_RELEASE: ${{ needs.version-gate.outputs.REAL_RELEASE }} + MAVEN_ARTIFACT_ID: offline-protocol-java + MAVEN_PACKAGING: jar + steps: + - name: Channel off + if: vars.MAVEN_CENTRAL_PUBLISH != 'true' + run: echo "::notice title=Java library not published::MAVEN_CENTRAL_PUBLISH is not 'true', so the library was built and tested and not uploaded." + + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + if: vars.MAVEN_CENTRAL_PUBLISH == 'true' + + - name: Download the library + if: vars.MAVEN_CENTRAL_PUBLISH == 'true' + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: java-library-maven + path: maven + + - name: Sign and bundle + if: vars.MAVEN_CENTRAL_PUBLISH == 'true' + env: + SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }} + SIGNING_KEY_PASSWORD: ${{ secrets.MAVEN_SIGNING_KEY_PASSWORD }} + run: | + set -euo pipefail + [ -n "$SIGNING_KEY" ] || { + echo "::error title=Missing signing key::MAVEN_CENTRAL_PUBLISH is on, and the MAVEN_SIGNING_KEY secret is empty." + exit 1 + } + bash scripts/maven-central-bundle.sh maven "$RUNNER_TEMP/central-bundle.zip" "$VERSION" + + # A dry run rehearses, as for the Android library. + - name: Upload to Maven Central + if: vars.MAVEN_CENTRAL_PUBLISH == 'true' + env: + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + run: | + set -euo pipefail + [ -n "$MAVEN_CENTRAL_USERNAME" ] && [ -n "$MAVEN_CENTRAL_PASSWORD" ] || { + echo "::error title=Missing Portal token::MAVEN_CENTRAL_PUBLISH is on, and MAVEN_CENTRAL_USERNAME or MAVEN_CENTRAL_PASSWORD is empty." + exit 1 + } + MODE=rehearse + [ "$REAL_RELEASE" = true ] && MODE=publish + bash scripts/maven-central-upload.sh "$RUNNER_TEMP/central-bundle.zip" "$MODE" "$VERSION" + # offline-protocol-sdk on PyPI, by trusted publishing: PyPI trusts this # workflow file and the `pypi` environment, so there is no token to store # or leak. The wheels are the ones `test-python-wheels` installed and tested. diff --git a/CHANGELOG.md b/CHANGELOG.md index 0820a42c..b0263996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,23 @@ archived by series under [docs/changelog/](docs/changelog/); see the ### Added +- **A Java binding.** `bindings/java` is a typed Java API generated from the + interface definition by `uniffi-bindgen-java`, the fourth member of the + artifact set that `scripts/generate-bindings.sh` writes with Swift, Kotlin + and Python. It reaches the native library through the Java foreign function + API, so it needs JDK 22 or later and brings no dependency: no JNA, no JNI, + no glue of its own, and it does not go through the C API. `OfflineProtocol`, + `MeshServices`, `DataStore`, every record and enum, the callback interfaces + a host implements (events, transports, storage providers) and a + `ProtocolException` subclass per engine refusal. The generated records have + no defaults, so a `ProtocolConfig` is spelled out in full. CI regenerates + and diffs the Java with the rest, and builds and tests it against the + library on Linux, macOS and Windows. The generator is versioned apart from UniFFI, so + the script refuses any series but 0.5. The jar is published to Maven + Central as `com.offlineprotocol:offline-protocol-java` by the release, beside + the Android library and under the same switch; it holds no native code, so the + host supplies the library from the release's assets. The contract is + `docs/bridges/java.md`. - **A C API.** `bindings/c/include/offline_protocol.h` declares about a dozen functions over the native library every release already ships: create an engine from a JSON configuration, call any method of the diff --git a/CLAUDE.md b/CLAUDE.md index f7cca6cc..8a07040c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -25,8 +25,9 @@ that are versioned, reviewable, and readable by people who are not an agent. | `offline-protocol-sealed`: the envelope codec, `derive_address`, canonical signing payloads, ratchet constants, the 1:1 control-frame prefixes, `KeyPackagePayload`, the identity assertion codec | ADR [0022](docs/adr/0022-one-sealed-layer-shared-with-the-leaf.md) (also dual std/no_std, and the one home for each) | | `offline-protocol-leaf`: anything a device does at pairing, on a frame, or with its store | ADR [0021](docs/adr/0021-a-leaf-node-speaks-mls.md) and [docs/spec/leaf-provisioning.md](docs/spec/leaf-provisioning.md) (a time source, real entropy, durable-before-emit and authorization are obligations, not suggestions) | | Replicated documents: the store, sync frames, attachments | [docs/spec/data-sync.md](docs/spec/data-sync.md), [the replication state machine](docs/state-machines/data-replication.md), ADR [0018](docs/adr/0018-data-layer-engine-and-storage-seams.md) and [0019](docs/adr/0019-remote-document-imports-are-contained-not-trusted.md) | -| Any binding: Swift, Kotlin, Python, TypeScript, C | [docs/bridges/](docs/bridges/README.md) | +| Any binding: Swift, Kotlin, Python, TypeScript, C, Java | [docs/bridges/](docs/bridges/README.md) | | The C API: `offline-protocol-uniffi/src/capi`, `bindings/c` | [docs/bridges/c.md](docs/bridges/c.md) (the dispatcher is generated from the UDL; the header is generated by cbindgen and committed) | +| The Java binding: `bindings/java` | [docs/bridges/java.md](docs/bridges/java.md) (generated from the UDL by `uniffi-bindgen-java`, whose 0.5 series is the one for UniFFI 0.32; no hand-written code, and `ConsumerCheckTest.config()` carries the definition's defaults because the generated records have none) | | The Swift package or the Android library: what is in them, how they are built | ADR [0025](docs/adr/0025-native-packages-are-assembled-in-place.md), [bindings/swift](bindings/swift/README.md), [bindings/kotlin](bindings/kotlin/README.md) | | The telemetry pipe: what it sends, when, the queue, the uploader | [docs/telemetry.md](docs/telemetry.md), the [network egress](docs/security/threat-model.md#network-egress) section of the threat model, and [docs/privacy.md](docs/privacy.md) | @@ -102,8 +103,8 @@ cargo build -p offline-protocol-leaf --example wasi_host_shim --target wasm32-wa ### UniFFI and mobile builds ```bash -# Regenerate EVERY binding after a UDL change: Swift, Kotlin and Python together. -# The three are one artifact set from one UDL, so there is one script. A partial +# Regenerate EVERY binding after a UDL change: Swift, Kotlin, Python and Java together. +# The four are one artifact set from one UDL, so there is one script. A partial # regeneration fails at runtime, not at build time. ./scripts/generate-bindings.sh @@ -115,8 +116,10 @@ npm run generate:bindings # wrapper for ../../scripts/generate-bindings. ``` Prerequisites: `cargo install uniffi --version 0.32.2 --features cli --locked` -(must match the workspace `uniffi = "0.32"` pin), Android NDK -(`ANDROID_NDK_HOME`), Xcode. +(must match the workspace `uniffi = "0.32"` pin), +`cargo install uniffi-bindgen-java --version 0.5.2 --locked` +(the Java generator is versioned apart from uniffi; its 0.5 series is the one +for UniFFI 0.32), Android NDK (`ANDROID_NDK_HOME`), Xcode. ### The C API @@ -132,6 +135,15 @@ scripts/generate-c-header.sh # write; --check to verify cargo build -p offline-protocol-uniffi && make -C bindings/c/consumer-check ``` +### The Java binding + +```bash +# Generated with the other bindings by scripts/generate-bindings.sh and committed. +# Needs JDK 22+ and the library built first; the tests load it. +cargo build -p offline-protocol-uniffi +cd bindings/java && gradle build # -PnativeLibrary=... for another build +``` + ### Native packages ```bash diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7fa023aa..28692b0c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ Thank you for your interest in contributing! This document provides guidelines f - Rust 1.87+ for the library crates, and Rust 1.91+ to build `offline-protocol-uniffi` (every binding, and the C library from source) or to install `uniffi-bindgen`, whose build dependencies need it (`rustup default stable` covers both) - For mobile bindings: Android NDK, Xcode -- For regenerating UniFFI bindings: `cargo install uniffi --version 0.32.2 --features cli --locked` (the CLI version must match the workspace `uniffi = "0.32"` pin; CI runs this command with `--force`, and so should you when replacing an older install) +- For regenerating UniFFI bindings: `cargo install uniffi --version 0.32.2 --features cli --locked` (the CLI version must match the workspace `uniffi = "0.32"` pin; CI runs this command with `--force`, and so should you when replacing an older install), and `cargo install uniffi-bindgen-java --version 0.5.2 --locked` for the Java binding ### Clone and Build @@ -103,7 +103,7 @@ test(dors): add tests for transport switching 2. **Tests**: Add comprehensive unit tests 3. **UniFFI**: Expose via UDL if needed for mobile platforms 4. **Regenerate**: After any UDL change run `./scripts/generate-bindings.sh` and commit - **all three** generated files (Swift, Kotlin, Python). They are one artifact set off one + **all four** generated sets (Swift, Kotlin, Python, Java). They are one artifact set off one UDL and carry the FFI checksums of the library they were generated against — committing a subset leaves the rest describing a different ABI, which no build catches; the app fails at its first FFI call instead. diff --git a/README.md b/README.md index 18c3c069..47e2a837 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Every channel carries the version number of the release it came from. | Swift, iOS (preview) | [`offline-protocol-swift`](https://github.com/Offline-Protocol/offline-protocol-swift), product `OfflineProtocolSDK` | Swift Package Manager, see below | | Android, Kotlin (preview) | A download on each [GitHub release](https://github.com/Offline-Protocol/offline-protocol-sdk/releases); not on Maven Central yet | See below | | C, and any language that calls C | `offline_protocol.h` and the native library in each [GitHub release](https://github.com/Offline-Protocol/offline-protocol-sdk/releases)'s desktop archives | See [bindings/c](bindings/c/README.md) | +| Java (JVM 22+, desktop and server) | Generated sources in [bindings/java](bindings/java/README.md), over the native library in each release's desktop archives; not on Maven Central yet | See [bindings/java](bindings/java/README.md) | **Python.** Wheels are published for Python 3.10 or later on macOS arm64 (macOS 14 or later), Linux x86_64 and aarch64 (`manylinux_2_34`, so glibc @@ -184,6 +185,7 @@ each plaintext send then emits a `security_warning` event with the ### Prerequisites - Rust (via rustup) - uniffi-bindgen: `cargo install uniffi --version 0.32.2 --features cli --locked` (must match the workspace `uniffi = "0.32"` pin) +- uniffi-bindgen-java: `cargo install uniffi-bindgen-java --version 0.5.2 --locked` (the 0.5 series generates for UniFFI 0.32) - For Android: the Android NDK (set `ANDROID_NDK_HOME`); for iOS: Xcode ### Build Mobile UniFFI Libraries @@ -205,12 +207,12 @@ npm run build:uniffi:android # Android only ./scripts/generate-bindings.sh ``` -One script generates all three languages — Swift, Kotlin and Python — because +One script generates all four languages — Swift, Kotlin, Python and Java — because they are one artifact set produced from one UDL and carry the FFI checksums of the library they were generated against. Regenerating a subset leaves the rest describing a different ABI, which no build catches; the app fails at the first call instead. `npm run generate:bindings` and the platform build scripts -delegate here, so every path produces the whole set. Commit all three together. +delegate here, so every path produces the whole set. Commit all four together. ### Build Python Desktop Bindings @@ -221,7 +223,7 @@ pip install -e . ``` The desktop build produces the native `.dylib`, `.so`, or `.dll` for the host -platform and regenerates the bindings (all three languages, via the shared +platform and regenerates the bindings (all four languages, via the shared script above). diff --git a/bindings/java/README.md b/bindings/java/README.md new file mode 100644 index 00000000..31cbefb2 --- /dev/null +++ b/bindings/java/README.md @@ -0,0 +1,151 @@ +# The Offline Protocol SDK from Java + +A typed Java API for the JVM on desktop and server, generated from the same +interface definition as the Swift, Kotlin and Python bindings by +[`uniffi-bindgen-java`](https://github.com/IronCoreLabs/uniffi-bindgen-java). +It calls the native library directly through the Java foreign function API +(final in Java 22): there is no JNA, no JNI and no native glue of its own, and +it does not go through the C API. + +The package is `com.offlineprotocol.sdk`. `OfflineProtocol` is the engine, +`MeshServices` and `DataStore` hang off it, every record and enum of the +definition is a class, and the things a host implements are interfaces: +`EventCallback`, the transport callbacks, and the two storage providers. An +engine refusal is a subclass of `ProtocolException` named for the variant +(`ProtocolException.EncryptFailed`). + +The contract is [docs/bridges/java.md](../../docs/bridges/java.md), on top of +the [shared one](../../docs/bridges/README.md). Read it before writing a +callback or a storage provider. + +## What you need + +| What | Where it comes from | +|---|---| +| JDK 22 or later | Yours. The generated code uses `java.lang.foreign` | +| This library's sources | [`src/main/java`](src/main/java), built with Gradle (below) | +| `liboffline_protocol_uniffi.so` / `.dylib` / `offline_protocol_uniffi.dll` | The release's desktop archives, or `cargo build --release -p offline-protocol-uniffi` | + +Run with `--enable-native-access=ALL-UNNAMED` (or the name of your module), or +the JVM warns on the first native call and a future release refuses it. + +The library is found through `java.library.path`. If it is somewhere else, name +the file: + +```sh +java --enable-native-access=ALL-UNNAMED \ + -Duniffi.component.offline_protocol.libraryOverride=/path/to/liboffline_protocol_uniffi.dylib ... +``` + +## Quick start + +```java +import com.offlineprotocol.sdk.*; + +// The generated record has no defaults: every field is spelled out, in the +// order of the definition (ProtocolConfig in offline_protocol.udl). Optional +// fields (mesh relay, custody) take null. +ProtocolConfig config = new ProtocolConfig( + "com.example.app", "default", + false, false, true, false, false, false, // ble, wifi direct, internet, reticulum, nostr, prefer online + (byte) 8, true, true, true, true, // ttl, encryption, auto key exchange, store pending, require encryption + 64L, 4096L, 60_000L, OverflowPolicy.DROP_OLDEST, + false, 256, true, true, false, false, + true, true, true, false, true, true, true, + null, null, + true, true, true); + +try (OfflineProtocol engine = new OfflineProtocol(config)) { + // Storage before start(). The store key seals key material at rest; + // keep it out of the source. + engine.initializeMlsWithFileStores("/var/lib/app/mls", "/var/lib/app/state", storeKey32Bytes); + + engine.setEventCallback(json -> queue.add(json)); // copy and return; never call the engine from here + engine.start(); + System.out.println("this device is " + engine.localAddress()); + + try { + engine.sendMessage("off1...", "hi", MessagePriority.MEDIUM, null); + } catch (ProtocolException.EncryptFailed e) { + // each engine refusal is its own exception type + } + engine.stop(); +} +``` + +`OfflineProtocolLib` holds the functions that need no engine +(`deriveAddress`, `parseInvite`, `verifyIdentityAssertion`, +`runStorageConformance`). + +## Events + +`setEventCallback` installs an `EventCallback`, or `pollEvent` takes the oldest +queued event; every event is queued either way. An event is JSON text, unchanged +from the engine, so parse it with the library you already use. The callback runs +on whichever thread is inside the engine and must not call back into it. + +## Transports and storage + +Your process is the platform, so you own the radios and sockets: implement the +`BleTransportCallback`, `WifiDirectTransportCallback`, +`ReticulumTransportCallback` and `NostrTransportCallback` notifications to learn +when a queue has frames, and drain them with the `ble*`, `wifiDirect*`, +`internet*`, `reticulum*` and `nostr*` methods. + +For storage, implement `MlsStorageProvider` (key material, back it with a +keystore) and `ProtocolStateStorageProvider`, and pass both to +`initializeMls`. Prove an adapter with +`OfflineProtocolLib.runStorageConformance`. Or use the built-in file stores, as +above. + +## Installing + +```kotlin +// build.gradle.kts +dependencies { + implementation("com.offlineprotocol:offline-protocol-java:") +} +``` + +The jar holds the generated Java and no native code. Download the native +library for your platform from the release's assets, and give the JVM its path: +`-Djava.library.path=`, or +`-Duniffi.component.offline_protocol.libraryOverride=` for an absolute +path. Run on JDK 22 or later with `--enable-native-access=ALL-UNNAMED`. On +Android use the AAR (`com.offlineprotocol:offline-protocol-sdk`) instead. + +## Telemetry + +Pass `TelemetryConfig.os` and `osMajor` as the platform you actually run on: +unlike Swift and Kotlin, there is no hand-written layer here to fill them. See +[docs/bridges/java.md](../../docs/bridges/java.md#j3-the-host-fills-the-telemetry-platform). + +## Building and testing + +The sources under `src/main/java` are generated and committed. To regenerate +them, with the other bindings: + +```sh +cargo install uniffi --version 0.32.2 --features cli --locked +cargo install uniffi-bindgen-java --version 0.5.2 --locked +./scripts/generate-bindings.sh +``` + +To build and test (JDK 22+, Gradle 9): + +```sh +cargo build -p offline-protocol-uniffi +cd bindings/java +gradle build # -PnativeLibrary=/path/to/the/library for another build +``` + +`build` compiles the generated sources, runs the consumer check against the +library, and writes the binary, sources and Javadoc jars to `build/libs`. +`publishAllPublicationsToStagingRepository` writes the Maven repository the +release signs and uploads, to `build/maven`. + +## Licensing + +Dual-licensed: [AGPL-3.0-only](../../LICENSE) for open-source use, or a +[commercial license](../../LICENSE-COMMERCIAL.md) for proprietary use. The +library contains cryptography; see [EXPORT.md](../../EXPORT.md). diff --git a/bindings/java/build.gradle.kts b/bindings/java/build.gradle.kts new file mode 100644 index 00000000..c8f5dec1 --- /dev/null +++ b/bindings/java/build.gradle.kts @@ -0,0 +1,139 @@ +// The Java binding. The sources under src/main/java are generated from the UDL by +// scripts/generate-bindings.sh and committed, like the Swift, Kotlin and Python +// bindings; they reach the native library through the foreign function API +// (final in Java 22), so there is no JNA and no native glue. +// +// Build with JDK 22 or later. The tests load the native library, so build it first. + +plugins { + `java-library` + `maven-publish` +} + +group = "com.offlineprotocol" +version = providers.gradleProperty("VERSION_NAME").get() + +java { + withSourcesJar() + withJavadocJar() +} + +dependencies { + testImplementation(platform("org.junit:junit-bom:5.10.2")) + testImplementation("org.junit.jupiter:junit-jupiter") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") +} + +// The notices the Rust library's licenses ask to travel with it, at the root of +// the jar's META-INF as the Android library carries them at the root of its AAR. +// Read from the repository root, not copied: a copy is a notice someone updates +// in one place. The jar holds no native code, so these cover the Java and the +// library the host supplies alongside it. +val legalFiles = listOf("LICENSE", "LICENSE-COMMERCIAL.md", "THIRD-PARTY-NOTICES.md", "EXPORT.md") +val repositoryRoot = layout.projectDirectory.dir("../..") + +legalFiles.forEach { name -> + require(repositoryRoot.file(name).asFile.isFile) { + "legalFiles names $name, which is not at ${repositoryRoot.asFile}" + } +} + +tasks.jar { + from(repositoryRoot) { + include(legalFiles) + into("META-INF") + } +} + +tasks.withType().configureEach { + options.release.set(22) +} + +// The generated Javadoc is not ours to fix up: it carries no comments, and the +// generator's own warnings would fail a -Werror build for nothing we wrote. +tasks.withType().configureEach { + (options as StandardJavadocDocletOptions).addBooleanOption("Xdoclint:none", true) +} + +// The tests load the real library. -PnativeLibrary names the file itself; +// the default is this checkout's Cargo debug output for the host. +tasks.test { + useJUnitPlatform() + val os = System.getProperty("os.name").lowercase() + val fileName = when { + os.contains("win") -> "offline_protocol_uniffi.dll" + os.contains("mac") -> "liboffline_protocol_uniffi.dylib" + else -> "liboffline_protocol_uniffi.so" + } + val library = providers.gradleProperty("nativeLibrary") + .orElse(layout.projectDirectory.file("../../target/debug/$fileName").asFile.absolutePath) + // The generated loader reads this property, then System.load()s an absolute path. + systemProperty("uniffi.component.offline_protocol.libraryOverride", library.get()) + jvmArgs("--enable-native-access=ALL-UNNAMED") + testLogging { + events("failed", "skipped") + exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL + } +} + +// com.offlineprotocol:offline-protocol-java. The Android library is +// offline-protocol-sdk; this one is a different artifact for a different +// runtime, so the two never share a coordinate. +publishing { + publications { + create("java") { + from(components["java"]) + + groupId = "com.offlineprotocol" + artifactId = "offline-protocol-java" + + pom { + name.set("Offline Protocol SDK for Java") + description.set( + "Offline-first messaging for the JVM: BLE mesh and internet relay " + + "transports, with MLS end-to-end encryption (RFC 9420) applied " + + "automatically. Needs JDK 22 or later, and the native library for " + + "the platform, which this jar does not contain." + ) + url.set("https://github.com/Offline-Protocol/offline-protocol-sdk") + licenses { + license { + name.set("AGPL-3.0-only") + url.set("https://www.gnu.org/licenses/agpl-3.0.txt") + distribution.set("repo") + comments.set( + "A commercial license is available. See " + + "LICENSE-COMMERCIAL.md in the source repository." + ) + } + } + developers { + developer { + id.set("offline-protocol") + name.set("Offline Protocol, Inc.") + url.set("https://www.offlineprotocol.com") + } + } + scm { + url.set("https://github.com/Offline-Protocol/offline-protocol-sdk") + connection.set( + "scm:git:https://github.com/Offline-Protocol/offline-protocol-sdk.git" + ) + developerConnection.set( + "scm:git:ssh://git@github.com/Offline-Protocol/offline-protocol-sdk.git" + ) + } + } + } + } + + // Where the library is written as a Maven repository, whatever it is later + // uploaded to. The release signs and uploads this; the key never enters a + // Gradle build (scripts/maven-central-bundle.sh). + repositories { + maven { + name = "staging" + url = uri(layout.buildDirectory.dir("maven")) + } + } +} diff --git a/bindings/java/gradle.properties b/bindings/java/gradle.properties new file mode 100644 index 00000000..8b2d7764 --- /dev/null +++ b/bindings/java/gradle.properties @@ -0,0 +1,2 @@ +# Overridden by the release with -PVERSION_NAME. +VERSION_NAME=0.0.0 diff --git a/bindings/java/settings.gradle.kts b/bindings/java/settings.gradle.kts new file mode 100644 index 00000000..6d965c60 --- /dev/null +++ b/bindings/java/settings.gradle.kts @@ -0,0 +1,11 @@ +// The Java binding, generated from the interface definition by +// uniffi-bindgen-java (docs/bridges/java.md). + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + mavenCentral() + } +} + +rootProject.name = "offline-protocol-java" diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/AckConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/AckConfig.java new file mode 100644 index 00000000..81c3c7c1 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/AckConfig.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + +public class AckConfig { + private long defaultTimeoutMs; + private long maxPendingAcks; + + public AckConfig( + long defaultTimeoutMs, + long maxPendingAcks + ) { + + this.defaultTimeoutMs = defaultTimeoutMs; + + this.maxPendingAcks = maxPendingAcks; + } + + public long defaultTimeoutMs() { + return this.defaultTimeoutMs; + } + + public long maxPendingAcks() { + return this.maxPendingAcks; + } + public void setDefaultTimeoutMs(long defaultTimeoutMs) { + this.defaultTimeoutMs = defaultTimeoutMs; + } + public void setMaxPendingAcks(long maxPendingAcks) { + this.maxPendingAcks = maxPendingAcks; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof AckConfig) { + AckConfig _uniffiThat = (AckConfig) _uniffiOther; + return ( + defaultTimeoutMs == _uniffiThat.defaultTimeoutMs && + + maxPendingAcks == _uniffiThat.maxPendingAcks + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(defaultTimeoutMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(maxPendingAcks); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/AppState.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/AppState.java new file mode 100644 index 00000000..89bcd5d6 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/AppState.java @@ -0,0 +1,16 @@ +package com.offlineprotocol.sdk; + + + +public enum AppState { + ACTIVE, + BACKGROUND, + INACTIVE; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/AutoCloseableHelper.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/AutoCloseableHelper.java new file mode 100644 index 00000000..a00346f0 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/AutoCloseableHelper.java @@ -0,0 +1,58 @@ +package com.offlineprotocol.sdk; + + +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +public interface AutoCloseableHelper { + // Use java.lang.Object to avoid conflict with user-defined Object types + static void close(java.lang.Object... args) { + Stream + .of(args) + .forEach(obj -> { + // this is all to avoid the problem reported in uniffi-rs#2467 + if (obj instanceof AutoCloseable) { + try { + ((AutoCloseable) obj).close(); + } catch (java.lang.Exception ex) { + throw new RuntimeException(ex); + } + } + if (obj instanceof List) { + for (int i = 0; i < ((List) obj).size(); i++) { + java.lang.Object element = ((List) obj).get(i); + if (element instanceof AutoCloseable) { + try { + ((AutoCloseable) element).close(); + } catch (java.lang.Exception ex) { + throw new RuntimeException(ex); + } + } + } + } + if (obj instanceof Map) { + for (var value : ((Map) obj).values()) { + if (value instanceof AutoCloseable) { + try { + ((AutoCloseable) value).close(); + } catch (java.lang.Exception ex) { + throw new RuntimeException(ex); + } + } + } + } + if (obj instanceof Iterable) { + for (var value : ((Iterable) obj)) { + if (value instanceof AutoCloseable) { + try { + ((AutoCloseable) value).close(); + } catch (java.lang.Exception ex) { + throw new RuntimeException(ex); + } + } + } + } + }); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/BleFragment.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/BleFragment.java new file mode 100644 index 00000000..757a101a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/BleFragment.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + +public class BleFragment { + private java.lang.String recipientId; + private java.util.List data; + + public BleFragment( + java.lang.String recipientId, + java.util.List data + ) { + + this.recipientId = recipientId; + + this.data = data; + } + + public java.lang.String recipientId() { + return this.recipientId; + } + + public java.util.List data() { + return this.data; + } + public void setRecipientId(java.lang.String recipientId) { + this.recipientId = recipientId; + } + public void setData(java.util.List data) { + this.data = data; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof BleFragment) { + BleFragment _uniffiThat = (BleFragment) _uniffiOther; + return ( + java.util.Objects.equals(recipientId, _uniffiThat.recipientId) && + + java.util.Objects.equals(data, _uniffiThat.data) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(recipientId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(data); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/BleTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/BleTransportCallback.java new file mode 100644 index 00000000..6a7e5f4a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/BleTransportCallback.java @@ -0,0 +1,6 @@ +package com.offlineprotocol.sdk; + +public interface BleTransportCallback { + public void onFragmentsAvailable(); + +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ContentType.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ContentType.java new file mode 100644 index 00000000..b00891bb --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ContentType.java @@ -0,0 +1,22 @@ +package com.offlineprotocol.sdk; + + + +public enum ContentType { + TEXT, + IMAGE, + VIDEO, + AUDIO, + VOICE_NOTE, + VIDEO_NOTE, + FILE, + FILE_CHUNK, + POLL; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/CustodyConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/CustodyConfig.java new file mode 100644 index 00000000..3b336c3a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/CustodyConfig.java @@ -0,0 +1,159 @@ +package com.offlineprotocol.sdk; + +public class CustodyConfig { + private java.lang.Boolean enabled; + private java.lang.Long holdMs; + private java.lang.Long maxEntriesPerDepositor; + private java.lang.Long maxBytesPerDepositor; + private java.lang.Long maxEntries; + private java.lang.Long maxBytes; + private java.lang.Long strangerMaxEntries; + private java.lang.Long strangerMaxBytes; + private OverflowPolicy overflowPolicy; + + public CustodyConfig( + java.lang.Boolean enabled, + java.lang.Long holdMs, + java.lang.Long maxEntriesPerDepositor, + java.lang.Long maxBytesPerDepositor, + java.lang.Long maxEntries, + java.lang.Long maxBytes, + java.lang.Long strangerMaxEntries, + java.lang.Long strangerMaxBytes, + OverflowPolicy overflowPolicy + ) { + + this.enabled = enabled; + + this.holdMs = holdMs; + + this.maxEntriesPerDepositor = maxEntriesPerDepositor; + + this.maxBytesPerDepositor = maxBytesPerDepositor; + + this.maxEntries = maxEntries; + + this.maxBytes = maxBytes; + + this.strangerMaxEntries = strangerMaxEntries; + + this.strangerMaxBytes = strangerMaxBytes; + + this.overflowPolicy = overflowPolicy; + } + + public java.lang.Boolean enabled() { + return this.enabled; + } + + public java.lang.Long holdMs() { + return this.holdMs; + } + + public java.lang.Long maxEntriesPerDepositor() { + return this.maxEntriesPerDepositor; + } + + public java.lang.Long maxBytesPerDepositor() { + return this.maxBytesPerDepositor; + } + + public java.lang.Long maxEntries() { + return this.maxEntries; + } + + public java.lang.Long maxBytes() { + return this.maxBytes; + } + + public java.lang.Long strangerMaxEntries() { + return this.strangerMaxEntries; + } + + public java.lang.Long strangerMaxBytes() { + return this.strangerMaxBytes; + } + + public OverflowPolicy overflowPolicy() { + return this.overflowPolicy; + } + public void setEnabled(java.lang.Boolean enabled) { + this.enabled = enabled; + } + public void setHoldMs(java.lang.Long holdMs) { + this.holdMs = holdMs; + } + public void setMaxEntriesPerDepositor(java.lang.Long maxEntriesPerDepositor) { + this.maxEntriesPerDepositor = maxEntriesPerDepositor; + } + public void setMaxBytesPerDepositor(java.lang.Long maxBytesPerDepositor) { + this.maxBytesPerDepositor = maxBytesPerDepositor; + } + public void setMaxEntries(java.lang.Long maxEntries) { + this.maxEntries = maxEntries; + } + public void setMaxBytes(java.lang.Long maxBytes) { + this.maxBytes = maxBytes; + } + public void setStrangerMaxEntries(java.lang.Long strangerMaxEntries) { + this.strangerMaxEntries = strangerMaxEntries; + } + public void setStrangerMaxBytes(java.lang.Long strangerMaxBytes) { + this.strangerMaxBytes = strangerMaxBytes; + } + public void setOverflowPolicy(OverflowPolicy overflowPolicy) { + this.overflowPolicy = overflowPolicy; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof CustodyConfig) { + CustodyConfig _uniffiThat = (CustodyConfig) _uniffiOther; + return ( + java.util.Objects.equals(enabled, _uniffiThat.enabled) && + + java.util.Objects.equals(holdMs, _uniffiThat.holdMs) && + + java.util.Objects.equals(maxEntriesPerDepositor, _uniffiThat.maxEntriesPerDepositor) && + + java.util.Objects.equals(maxBytesPerDepositor, _uniffiThat.maxBytesPerDepositor) && + + java.util.Objects.equals(maxEntries, _uniffiThat.maxEntries) && + + java.util.Objects.equals(maxBytes, _uniffiThat.maxBytes) && + + java.util.Objects.equals(strangerMaxEntries, _uniffiThat.strangerMaxEntries) && + + java.util.Objects.equals(strangerMaxBytes, _uniffiThat.strangerMaxBytes) && + + java.util.Objects.equals(overflowPolicy, _uniffiThat.overflowPolicy) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(enabled); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(holdMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(maxEntriesPerDepositor); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(maxBytesPerDepositor); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(maxEntries); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(maxBytes); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(strangerMaxEntries); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(strangerMaxBytes); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(overflowPolicy); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/CustodyStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/CustodyStats.java new file mode 100644 index 00000000..9b2102d5 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/CustodyStats.java @@ -0,0 +1,341 @@ +package com.offlineprotocol.sdk; + +public class CustodyStats { + private long held; + private long heldBytes; + private long accepted; + private long delivered; + private long reOriginated; + private long expired; + private long duplicates; + private long evicted; + private long receiptsSent; + private long receiptsDropped; + private long receiptsReceived; + private long receiptsIgnored; + private long refusedDisabled; + private long refusedNoRequest; + private long refusedUnknownClass; + private long refusedNotSealed; + private long refusedUnprovenPeer; + private long refusedNotDepositor; + private long refusedStranger; + private long refusedDepositorFull; + private long refusedStoreFull; + private long refusedBattery; + + public CustodyStats( + long held, + long heldBytes, + long accepted, + long delivered, + long reOriginated, + long expired, + long duplicates, + long evicted, + long receiptsSent, + long receiptsDropped, + long receiptsReceived, + long receiptsIgnored, + long refusedDisabled, + long refusedNoRequest, + long refusedUnknownClass, + long refusedNotSealed, + long refusedUnprovenPeer, + long refusedNotDepositor, + long refusedStranger, + long refusedDepositorFull, + long refusedStoreFull, + long refusedBattery + ) { + + this.held = held; + + this.heldBytes = heldBytes; + + this.accepted = accepted; + + this.delivered = delivered; + + this.reOriginated = reOriginated; + + this.expired = expired; + + this.duplicates = duplicates; + + this.evicted = evicted; + + this.receiptsSent = receiptsSent; + + this.receiptsDropped = receiptsDropped; + + this.receiptsReceived = receiptsReceived; + + this.receiptsIgnored = receiptsIgnored; + + this.refusedDisabled = refusedDisabled; + + this.refusedNoRequest = refusedNoRequest; + + this.refusedUnknownClass = refusedUnknownClass; + + this.refusedNotSealed = refusedNotSealed; + + this.refusedUnprovenPeer = refusedUnprovenPeer; + + this.refusedNotDepositor = refusedNotDepositor; + + this.refusedStranger = refusedStranger; + + this.refusedDepositorFull = refusedDepositorFull; + + this.refusedStoreFull = refusedStoreFull; + + this.refusedBattery = refusedBattery; + } + + public long held() { + return this.held; + } + + public long heldBytes() { + return this.heldBytes; + } + + public long accepted() { + return this.accepted; + } + + public long delivered() { + return this.delivered; + } + + public long reOriginated() { + return this.reOriginated; + } + + public long expired() { + return this.expired; + } + + public long duplicates() { + return this.duplicates; + } + + public long evicted() { + return this.evicted; + } + + public long receiptsSent() { + return this.receiptsSent; + } + + public long receiptsDropped() { + return this.receiptsDropped; + } + + public long receiptsReceived() { + return this.receiptsReceived; + } + + public long receiptsIgnored() { + return this.receiptsIgnored; + } + + public long refusedDisabled() { + return this.refusedDisabled; + } + + public long refusedNoRequest() { + return this.refusedNoRequest; + } + + public long refusedUnknownClass() { + return this.refusedUnknownClass; + } + + public long refusedNotSealed() { + return this.refusedNotSealed; + } + + public long refusedUnprovenPeer() { + return this.refusedUnprovenPeer; + } + + public long refusedNotDepositor() { + return this.refusedNotDepositor; + } + + public long refusedStranger() { + return this.refusedStranger; + } + + public long refusedDepositorFull() { + return this.refusedDepositorFull; + } + + public long refusedStoreFull() { + return this.refusedStoreFull; + } + + public long refusedBattery() { + return this.refusedBattery; + } + public void setHeld(long held) { + this.held = held; + } + public void setHeldBytes(long heldBytes) { + this.heldBytes = heldBytes; + } + public void setAccepted(long accepted) { + this.accepted = accepted; + } + public void setDelivered(long delivered) { + this.delivered = delivered; + } + public void setReOriginated(long reOriginated) { + this.reOriginated = reOriginated; + } + public void setExpired(long expired) { + this.expired = expired; + } + public void setDuplicates(long duplicates) { + this.duplicates = duplicates; + } + public void setEvicted(long evicted) { + this.evicted = evicted; + } + public void setReceiptsSent(long receiptsSent) { + this.receiptsSent = receiptsSent; + } + public void setReceiptsDropped(long receiptsDropped) { + this.receiptsDropped = receiptsDropped; + } + public void setReceiptsReceived(long receiptsReceived) { + this.receiptsReceived = receiptsReceived; + } + public void setReceiptsIgnored(long receiptsIgnored) { + this.receiptsIgnored = receiptsIgnored; + } + public void setRefusedDisabled(long refusedDisabled) { + this.refusedDisabled = refusedDisabled; + } + public void setRefusedNoRequest(long refusedNoRequest) { + this.refusedNoRequest = refusedNoRequest; + } + public void setRefusedUnknownClass(long refusedUnknownClass) { + this.refusedUnknownClass = refusedUnknownClass; + } + public void setRefusedNotSealed(long refusedNotSealed) { + this.refusedNotSealed = refusedNotSealed; + } + public void setRefusedUnprovenPeer(long refusedUnprovenPeer) { + this.refusedUnprovenPeer = refusedUnprovenPeer; + } + public void setRefusedNotDepositor(long refusedNotDepositor) { + this.refusedNotDepositor = refusedNotDepositor; + } + public void setRefusedStranger(long refusedStranger) { + this.refusedStranger = refusedStranger; + } + public void setRefusedDepositorFull(long refusedDepositorFull) { + this.refusedDepositorFull = refusedDepositorFull; + } + public void setRefusedStoreFull(long refusedStoreFull) { + this.refusedStoreFull = refusedStoreFull; + } + public void setRefusedBattery(long refusedBattery) { + this.refusedBattery = refusedBattery; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof CustodyStats) { + CustodyStats _uniffiThat = (CustodyStats) _uniffiOther; + return ( + held == _uniffiThat.held && + + heldBytes == _uniffiThat.heldBytes && + + accepted == _uniffiThat.accepted && + + delivered == _uniffiThat.delivered && + + reOriginated == _uniffiThat.reOriginated && + + expired == _uniffiThat.expired && + + duplicates == _uniffiThat.duplicates && + + evicted == _uniffiThat.evicted && + + receiptsSent == _uniffiThat.receiptsSent && + + receiptsDropped == _uniffiThat.receiptsDropped && + + receiptsReceived == _uniffiThat.receiptsReceived && + + receiptsIgnored == _uniffiThat.receiptsIgnored && + + refusedDisabled == _uniffiThat.refusedDisabled && + + refusedNoRequest == _uniffiThat.refusedNoRequest && + + refusedUnknownClass == _uniffiThat.refusedUnknownClass && + + refusedNotSealed == _uniffiThat.refusedNotSealed && + + refusedUnprovenPeer == _uniffiThat.refusedUnprovenPeer && + + refusedNotDepositor == _uniffiThat.refusedNotDepositor && + + refusedStranger == _uniffiThat.refusedStranger && + + refusedDepositorFull == _uniffiThat.refusedDepositorFull && + + refusedStoreFull == _uniffiThat.refusedStoreFull && + + refusedBattery == _uniffiThat.refusedBattery + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(held); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(heldBytes); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(accepted); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(delivered); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(reOriginated); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(expired); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(duplicates); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(evicted); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(receiptsSent); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(receiptsDropped); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(receiptsReceived); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(receiptsIgnored); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedDisabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedNoRequest); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedUnknownClass); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedNotSealed); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedUnprovenPeer); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedNotDepositor); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedStranger); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedDepositorFull); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedStoreFull); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedBattery); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/DataStore.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/DataStore.java new file mode 100644 index 00000000..5940d0fb --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/DataStore.java @@ -0,0 +1,1108 @@ +package com.offlineprotocol.sdk; + +public class DataStore implements AutoCloseable, DataStoreInterface { + protected long handle; + protected UniffiCleaner.Cleanable cleanable; + + private java.util.concurrent.atomic.AtomicBoolean wasDestroyed = new java.util.concurrent.atomic.AtomicBoolean(false); + private java.util.concurrent.atomic.AtomicLong callCounter = new java.util.concurrent.atomic.AtomicLong(1); + + /** + * Internal constructor to wrap a raw handle from FFI. + * The UniffiWithHandle marker disambiguates this from other constructors. + */ + public DataStore(UniffiWithHandle phantom, long handle) { + this.handle = handle; + this.cleanable = UniffiLib.CLEANER.register(this, new UniffiCleanAction(handle)); + } + + /** + * This constructor can be used to instantiate a fake object. Only used for tests. Any + * attempt to actually use an object constructed this way will fail as there is no + * connected Rust object. + */ + public DataStore(NoHandle noHandle) { + this.handle = 0L; + this.cleanable = null; + } + + + public DataStore(OfflineProtocol protocol) throws ProtocolException{ + this(UniffiWithHandle.INSTANCE, (long) + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_constructor_datastore_new( + FfiConverterTypeOfflineProtocol.INSTANCE.lower(protocol), _status); + }) + ); + } + + @Override + public synchronized void close() { + // Only allow a single call to this method. + // TODO(uniffi): maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + if (cleanable != null) { + cleanable.clean(); + } + } + } + } + + public R callWithHandle(java.util.function.Function block) { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + long c; + do { + c = this.callCounter.get(); + if (c == 0L) { + throw new java.lang.IllegalStateException("DataStore object has already been destroyed"); + } + if (c == java.lang.Long.MAX_VALUE) { + throw new java.lang.IllegalStateException("DataStore call counter would overflow"); + } + } while (! this.callCounter.compareAndSet(c, c + 1L)); + // Now we can safely do the method call without the handle being freed concurrently. + try { + return block.apply(this.uniffiCloneHandle()); + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + if (cleanable != null) { + cleanable.clean(); + } + } + } + } + + public void callWithHandle(java.util.function.Consumer block) { + callWithHandle((java.lang.Long uniffiHandle) -> { + block.accept(uniffiHandle); + return (java.lang.Void)null; + }); + } + + private class UniffiCleanAction implements Runnable { + private final long handle; + + public UniffiCleanAction(long handle) { + this.handle = handle; + } + + @Override + public void run() { + // If the handle is 0 this is a fake object created with `NoHandle`, don't try to free. + if (handle != 0L) { + UniffiHelpers.uniffiRustCall((_allocator, status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_free_datastore(handle, status); + return null; + }); + } + } + } + + long uniffiCloneHandle() { + return UniffiHelpers.uniffiRustCall((_allocator, status) -> { + if (handle == 0L) { + throw new java.lang.NullPointerException(); + } + return UniffiLib.uniffi_offline_protocol_uniffi_fn_clone_datastore(handle, status); + }); + } + + + @Override + public java.lang.String attachmentHash(byte[] data) { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_attachment_hash(_allocator, _uniffiHandle, + FfiConverterByteArray.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void counterIncrement(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, double amount) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_counter_increment(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), amount, _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public double counterValue(java.lang.String spaceId, java.lang.String docId, java.lang.String collection) throws ProtocolException { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithErrorDouble(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_counter_value(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void createDoc(java.lang.String spaceId, java.lang.String docId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_create_doc(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void declineAttachment(java.lang.String spaceId, java.lang.String peerId, java.lang.String hash) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_decline_attachment(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(peerId), FfiConverterString.INSTANCE.lower(hash), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void deleteDoc(java.lang.String spaceId, java.lang.String docId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_delete_doc(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String docJson(java.lang.String spaceId, java.lang.String docId) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_doc_json(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public long docSize(java.lang.String spaceId, java.lang.String docId) throws ProtocolException { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithErrorLong(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_doc_size(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public byte[] exportRaw(java.lang.String spaceId, java.lang.String docId) throws ProtocolException { + try { + return FfiConverterByteArray.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_export_raw(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void fetchAttachment(java.lang.String spaceId, java.lang.String hash) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(hash), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void fetchAttachmentFrom(java.lang.String spaceId, java.lang.String peerId, java.lang.String hash) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment_from(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(peerId), FfiConverterString.INSTANCE.lower(hash), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void flush(java.lang.String spaceId, java.lang.String docId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_flush(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void flushAll() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_flush_all(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void listDelete(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, int index, int count) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_list_delete(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), index, count, _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List listDocs(java.lang.String spaceId) throws ProtocolException { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_list_docs(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public int listLen(java.lang.String spaceId, java.lang.String docId, java.lang.String collection) throws ProtocolException { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithErrorInt(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_list_len(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void listPush(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, java.lang.String valueJson) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_list_push(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), FfiConverterString.INSTANCE.lower(valueJson), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List listSpaces() throws ProtocolException { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_list_spaces(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void mapDelete(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, java.lang.String key) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_map_delete(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), FfiConverterString.INSTANCE.lower(key), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String mapGetJson(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, java.lang.String key) throws ProtocolException { + try { + return FfiConverterOptionalString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_map_get_json(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), FfiConverterString.INSTANCE.lower(key), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void mapSet(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, java.lang.String key, java.lang.String valueJson) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_map_set(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), FfiConverterString.INSTANCE.lower(key), FfiConverterString.INSTANCE.lower(valueJson), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void provideAttachment(java.lang.String spaceId, java.lang.String peerId, java.lang.String hash, byte[] data) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_provide_attachment(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(peerId), FfiConverterString.INSTANCE.lower(hash), FfiConverterByteArray.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void removeDoc(java.lang.String spaceId, java.lang.String docId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_remove_doc(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void removeSpace(java.lang.String spaceId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_remove_space(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setInterest(java.lang.String spaceId, java.util.List patterns) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_set_interest(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterSequenceString.INSTANCE.lower(patterns), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void textDelete(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, int position, int count) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_text_delete(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), position, count, _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void textInsert(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, int position, java.lang.String text) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_text_insert(_uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), position, FfiConverterString.INSTANCE.lower(text), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String textValue(java.lang.String spaceId, java.lang.String docId, java.lang.String collection) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_text_value(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(spaceId), FfiConverterString.INSTANCE.lower(docId), FfiConverterString.INSTANCE.lower(collection), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void wipeAll() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_datastore_wipe_all(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + + + + + public static DataStore withStorage(OfflineProtocol protocol, ProtocolStateStorageProvider storage) throws ProtocolException { + try { + return FfiConverterTypeDataStore.INSTANCE.lift( + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_constructor_datastore_with_storage( + FfiConverterTypeOfflineProtocol.INSTANCE.lower(protocol), FfiConverterTypeProtocolStateStorageProvider.INSTANCE.lower(storage), _status); + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/DataStoreInterface.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/DataStoreInterface.java new file mode 100644 index 00000000..38b4be9a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/DataStoreInterface.java @@ -0,0 +1,35 @@ +package com.offlineprotocol.sdk; + +public interface DataStoreInterface { + public java.lang.String attachmentHash(byte[] data); + public void counterIncrement(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, double amount) throws ProtocolException; + public double counterValue(java.lang.String spaceId, java.lang.String docId, java.lang.String collection) throws ProtocolException; + public void createDoc(java.lang.String spaceId, java.lang.String docId) throws ProtocolException; + public void declineAttachment(java.lang.String spaceId, java.lang.String peerId, java.lang.String hash) throws ProtocolException; + public void deleteDoc(java.lang.String spaceId, java.lang.String docId) throws ProtocolException; + public java.lang.String docJson(java.lang.String spaceId, java.lang.String docId) throws ProtocolException; + public long docSize(java.lang.String spaceId, java.lang.String docId) throws ProtocolException; + public byte[] exportRaw(java.lang.String spaceId, java.lang.String docId) throws ProtocolException; + public void fetchAttachment(java.lang.String spaceId, java.lang.String hash) throws ProtocolException; + public void fetchAttachmentFrom(java.lang.String spaceId, java.lang.String peerId, java.lang.String hash) throws ProtocolException; + public void flush(java.lang.String spaceId, java.lang.String docId) throws ProtocolException; + public void flushAll() throws ProtocolException; + public void listDelete(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, int index, int count) throws ProtocolException; + public java.util.List listDocs(java.lang.String spaceId) throws ProtocolException; + public int listLen(java.lang.String spaceId, java.lang.String docId, java.lang.String collection) throws ProtocolException; + public void listPush(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, java.lang.String valueJson) throws ProtocolException; + public java.util.List listSpaces() throws ProtocolException; + public void mapDelete(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, java.lang.String key) throws ProtocolException; + public java.lang.String mapGetJson(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, java.lang.String key) throws ProtocolException; + public void mapSet(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, java.lang.String key, java.lang.String valueJson) throws ProtocolException; + public void provideAttachment(java.lang.String spaceId, java.lang.String peerId, java.lang.String hash, byte[] data) throws ProtocolException; + public void removeDoc(java.lang.String spaceId, java.lang.String docId) throws ProtocolException; + public void removeSpace(java.lang.String spaceId) throws ProtocolException; + public void setInterest(java.lang.String spaceId, java.util.List patterns) throws ProtocolException; + public void textDelete(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, int position, int count) throws ProtocolException; + public void textInsert(java.lang.String spaceId, java.lang.String docId, java.lang.String collection, int position, java.lang.String text) throws ProtocolException; + public java.lang.String textValue(java.lang.String spaceId, java.lang.String docId, java.lang.String collection) throws ProtocolException; + public void wipeAll() throws ProtocolException; + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/DedupConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/DedupConfig.java new file mode 100644 index 00000000..985cc7f5 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/DedupConfig.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + +public class DedupConfig { + private long maxTrackedMessages; + private long retentionTimeSecs; + + public DedupConfig( + long maxTrackedMessages, + long retentionTimeSecs + ) { + + this.maxTrackedMessages = maxTrackedMessages; + + this.retentionTimeSecs = retentionTimeSecs; + } + + public long maxTrackedMessages() { + return this.maxTrackedMessages; + } + + public long retentionTimeSecs() { + return this.retentionTimeSecs; + } + public void setMaxTrackedMessages(long maxTrackedMessages) { + this.maxTrackedMessages = maxTrackedMessages; + } + public void setRetentionTimeSecs(long retentionTimeSecs) { + this.retentionTimeSecs = retentionTimeSecs; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof DedupConfig) { + DedupConfig _uniffiThat = (DedupConfig) _uniffiOther; + return ( + maxTrackedMessages == _uniffiThat.maxTrackedMessages && + + retentionTimeSecs == _uniffiThat.retentionTimeSecs + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(maxTrackedMessages); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(retentionTimeSecs); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/DedupStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/DedupStats.java new file mode 100644 index 00000000..3c14ae3d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/DedupStats.java @@ -0,0 +1,89 @@ +package com.offlineprotocol.sdk; + +public class DedupStats { + private long totalTracked; + private long recentTracked; + private byte capacityUsedPercent; + private java.lang.String mode; + + public DedupStats( + long totalTracked, + long recentTracked, + byte capacityUsedPercent, + java.lang.String mode + ) { + + this.totalTracked = totalTracked; + + this.recentTracked = recentTracked; + + this.capacityUsedPercent = capacityUsedPercent; + + this.mode = mode; + } + + public long totalTracked() { + return this.totalTracked; + } + + public long recentTracked() { + return this.recentTracked; + } + + public byte capacityUsedPercent() { + return this.capacityUsedPercent; + } + + public java.lang.String mode() { + return this.mode; + } + public void setTotalTracked(long totalTracked) { + this.totalTracked = totalTracked; + } + public void setRecentTracked(long recentTracked) { + this.recentTracked = recentTracked; + } + public void setCapacityUsedPercent(byte capacityUsedPercent) { + this.capacityUsedPercent = capacityUsedPercent; + } + public void setMode(java.lang.String mode) { + this.mode = mode; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof DedupStats) { + DedupStats _uniffiThat = (DedupStats) _uniffiOther; + return ( + totalTracked == _uniffiThat.totalTracked && + + recentTracked == _uniffiThat.recentTracked && + + capacityUsedPercent == _uniffiThat.capacityUsedPercent && + + java.util.Objects.equals(mode, _uniffiThat.mode) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(totalTracked); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(recentTracked); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(capacityUsedPercent); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(mode); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/DorsConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/DorsConfig.java new file mode 100644 index 00000000..83c23f21 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/DorsConfig.java @@ -0,0 +1,285 @@ +package com.offlineprotocol.sdk; + +public class DorsConfig { + private boolean preferOnline; + private float switchHysteresis; + private long switchCooldownSecs; + private int bleToWifiRetryThreshold; + private float minSuccessRateBeforeEscalation; + private long minBleSamplesBeforeSuccessRateEscalation; + private short rssiSwitchThreshold; + private long congestionQueueThreshold; + private long stabilityWindowSecs; + private long poorSignalDurationSecs; + private byte ttlEscalationThreshold; + private long congestionDurationSecs; + private long ttlEscalationHoldSecs; + private long historyWindowSize; + private float queueRecoveryRatio; + private byte lowBatteryThreshold; + private byte relayMinBatteryLevel; + private byte relayOptimalConnectionCount; + + public DorsConfig( + boolean preferOnline, + float switchHysteresis, + long switchCooldownSecs, + int bleToWifiRetryThreshold, + float minSuccessRateBeforeEscalation, + long minBleSamplesBeforeSuccessRateEscalation, + short rssiSwitchThreshold, + long congestionQueueThreshold, + long stabilityWindowSecs, + long poorSignalDurationSecs, + byte ttlEscalationThreshold, + long congestionDurationSecs, + long ttlEscalationHoldSecs, + long historyWindowSize, + float queueRecoveryRatio, + byte lowBatteryThreshold, + byte relayMinBatteryLevel, + byte relayOptimalConnectionCount + ) { + + this.preferOnline = preferOnline; + + this.switchHysteresis = switchHysteresis; + + this.switchCooldownSecs = switchCooldownSecs; + + this.bleToWifiRetryThreshold = bleToWifiRetryThreshold; + + this.minSuccessRateBeforeEscalation = minSuccessRateBeforeEscalation; + + this.minBleSamplesBeforeSuccessRateEscalation = minBleSamplesBeforeSuccessRateEscalation; + + this.rssiSwitchThreshold = rssiSwitchThreshold; + + this.congestionQueueThreshold = congestionQueueThreshold; + + this.stabilityWindowSecs = stabilityWindowSecs; + + this.poorSignalDurationSecs = poorSignalDurationSecs; + + this.ttlEscalationThreshold = ttlEscalationThreshold; + + this.congestionDurationSecs = congestionDurationSecs; + + this.ttlEscalationHoldSecs = ttlEscalationHoldSecs; + + this.historyWindowSize = historyWindowSize; + + this.queueRecoveryRatio = queueRecoveryRatio; + + this.lowBatteryThreshold = lowBatteryThreshold; + + this.relayMinBatteryLevel = relayMinBatteryLevel; + + this.relayOptimalConnectionCount = relayOptimalConnectionCount; + } + + public boolean preferOnline() { + return this.preferOnline; + } + + public float switchHysteresis() { + return this.switchHysteresis; + } + + public long switchCooldownSecs() { + return this.switchCooldownSecs; + } + + public int bleToWifiRetryThreshold() { + return this.bleToWifiRetryThreshold; + } + + public float minSuccessRateBeforeEscalation() { + return this.minSuccessRateBeforeEscalation; + } + + public long minBleSamplesBeforeSuccessRateEscalation() { + return this.minBleSamplesBeforeSuccessRateEscalation; + } + + public short rssiSwitchThreshold() { + return this.rssiSwitchThreshold; + } + + public long congestionQueueThreshold() { + return this.congestionQueueThreshold; + } + + public long stabilityWindowSecs() { + return this.stabilityWindowSecs; + } + + public long poorSignalDurationSecs() { + return this.poorSignalDurationSecs; + } + + public byte ttlEscalationThreshold() { + return this.ttlEscalationThreshold; + } + + public long congestionDurationSecs() { + return this.congestionDurationSecs; + } + + public long ttlEscalationHoldSecs() { + return this.ttlEscalationHoldSecs; + } + + public long historyWindowSize() { + return this.historyWindowSize; + } + + public float queueRecoveryRatio() { + return this.queueRecoveryRatio; + } + + public byte lowBatteryThreshold() { + return this.lowBatteryThreshold; + } + + public byte relayMinBatteryLevel() { + return this.relayMinBatteryLevel; + } + + public byte relayOptimalConnectionCount() { + return this.relayOptimalConnectionCount; + } + public void setPreferOnline(boolean preferOnline) { + this.preferOnline = preferOnline; + } + public void setSwitchHysteresis(float switchHysteresis) { + this.switchHysteresis = switchHysteresis; + } + public void setSwitchCooldownSecs(long switchCooldownSecs) { + this.switchCooldownSecs = switchCooldownSecs; + } + public void setBleToWifiRetryThreshold(int bleToWifiRetryThreshold) { + this.bleToWifiRetryThreshold = bleToWifiRetryThreshold; + } + public void setMinSuccessRateBeforeEscalation(float minSuccessRateBeforeEscalation) { + this.minSuccessRateBeforeEscalation = minSuccessRateBeforeEscalation; + } + public void setMinBleSamplesBeforeSuccessRateEscalation(long minBleSamplesBeforeSuccessRateEscalation) { + this.minBleSamplesBeforeSuccessRateEscalation = minBleSamplesBeforeSuccessRateEscalation; + } + public void setRssiSwitchThreshold(short rssiSwitchThreshold) { + this.rssiSwitchThreshold = rssiSwitchThreshold; + } + public void setCongestionQueueThreshold(long congestionQueueThreshold) { + this.congestionQueueThreshold = congestionQueueThreshold; + } + public void setStabilityWindowSecs(long stabilityWindowSecs) { + this.stabilityWindowSecs = stabilityWindowSecs; + } + public void setPoorSignalDurationSecs(long poorSignalDurationSecs) { + this.poorSignalDurationSecs = poorSignalDurationSecs; + } + public void setTtlEscalationThreshold(byte ttlEscalationThreshold) { + this.ttlEscalationThreshold = ttlEscalationThreshold; + } + public void setCongestionDurationSecs(long congestionDurationSecs) { + this.congestionDurationSecs = congestionDurationSecs; + } + public void setTtlEscalationHoldSecs(long ttlEscalationHoldSecs) { + this.ttlEscalationHoldSecs = ttlEscalationHoldSecs; + } + public void setHistoryWindowSize(long historyWindowSize) { + this.historyWindowSize = historyWindowSize; + } + public void setQueueRecoveryRatio(float queueRecoveryRatio) { + this.queueRecoveryRatio = queueRecoveryRatio; + } + public void setLowBatteryThreshold(byte lowBatteryThreshold) { + this.lowBatteryThreshold = lowBatteryThreshold; + } + public void setRelayMinBatteryLevel(byte relayMinBatteryLevel) { + this.relayMinBatteryLevel = relayMinBatteryLevel; + } + public void setRelayOptimalConnectionCount(byte relayOptimalConnectionCount) { + this.relayOptimalConnectionCount = relayOptimalConnectionCount; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof DorsConfig) { + DorsConfig _uniffiThat = (DorsConfig) _uniffiOther; + return ( + preferOnline == _uniffiThat.preferOnline && + + java.lang.Float.compare(switchHysteresis, _uniffiThat.switchHysteresis) == 0 && + + switchCooldownSecs == _uniffiThat.switchCooldownSecs && + + bleToWifiRetryThreshold == _uniffiThat.bleToWifiRetryThreshold && + + java.lang.Float.compare(minSuccessRateBeforeEscalation, _uniffiThat.minSuccessRateBeforeEscalation) == 0 && + + minBleSamplesBeforeSuccessRateEscalation == _uniffiThat.minBleSamplesBeforeSuccessRateEscalation && + + rssiSwitchThreshold == _uniffiThat.rssiSwitchThreshold && + + congestionQueueThreshold == _uniffiThat.congestionQueueThreshold && + + stabilityWindowSecs == _uniffiThat.stabilityWindowSecs && + + poorSignalDurationSecs == _uniffiThat.poorSignalDurationSecs && + + ttlEscalationThreshold == _uniffiThat.ttlEscalationThreshold && + + congestionDurationSecs == _uniffiThat.congestionDurationSecs && + + ttlEscalationHoldSecs == _uniffiThat.ttlEscalationHoldSecs && + + historyWindowSize == _uniffiThat.historyWindowSize && + + java.lang.Float.compare(queueRecoveryRatio, _uniffiThat.queueRecoveryRatio) == 0 && + + lowBatteryThreshold == _uniffiThat.lowBatteryThreshold && + + relayMinBatteryLevel == _uniffiThat.relayMinBatteryLevel && + + relayOptimalConnectionCount == _uniffiThat.relayOptimalConnectionCount + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(preferOnline); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(switchHysteresis); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(switchCooldownSecs); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(bleToWifiRetryThreshold); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(minSuccessRateBeforeEscalation); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(minBleSamplesBeforeSuccessRateEscalation); + _uniffiHash = 31 * _uniffiHash + java.lang.Short.hashCode(rssiSwitchThreshold); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(congestionQueueThreshold); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(stabilityWindowSecs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(poorSignalDurationSecs); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(ttlEscalationThreshold); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(congestionDurationSecs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(ttlEscalationHoldSecs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(historyWindowSize); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(queueRecoveryRatio); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(lowBatteryThreshold); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(relayMinBatteryLevel); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(relayOptimalConnectionCount); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/EncryptionConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/EncryptionConfig.java new file mode 100644 index 00000000..546a4793 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/EncryptionConfig.java @@ -0,0 +1,103 @@ +package com.offlineprotocol.sdk; + +public class EncryptionConfig { + private boolean enabled; + private boolean autoKeyExchange; + private boolean storePending; + private boolean requireEncryption; + private PendingQueueConfig pendingQueue; + + public EncryptionConfig( + boolean enabled, + boolean autoKeyExchange, + boolean storePending, + boolean requireEncryption, + PendingQueueConfig pendingQueue + ) { + + this.enabled = enabled; + + this.autoKeyExchange = autoKeyExchange; + + this.storePending = storePending; + + this.requireEncryption = requireEncryption; + + this.pendingQueue = pendingQueue; + } + + public boolean enabled() { + return this.enabled; + } + + public boolean autoKeyExchange() { + return this.autoKeyExchange; + } + + public boolean storePending() { + return this.storePending; + } + + public boolean requireEncryption() { + return this.requireEncryption; + } + + public PendingQueueConfig pendingQueue() { + return this.pendingQueue; + } + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public void setAutoKeyExchange(boolean autoKeyExchange) { + this.autoKeyExchange = autoKeyExchange; + } + public void setStorePending(boolean storePending) { + this.storePending = storePending; + } + public void setRequireEncryption(boolean requireEncryption) { + this.requireEncryption = requireEncryption; + } + public void setPendingQueue(PendingQueueConfig pendingQueue) { + this.pendingQueue = pendingQueue; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof EncryptionConfig) { + EncryptionConfig _uniffiThat = (EncryptionConfig) _uniffiOther; + return ( + enabled == _uniffiThat.enabled && + + autoKeyExchange == _uniffiThat.autoKeyExchange && + + storePending == _uniffiThat.storePending && + + requireEncryption == _uniffiThat.requireEncryption && + + java.util.Objects.equals(pendingQueue, _uniffiThat.pendingQueue) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(enabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(autoKeyExchange); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(storePending); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(requireEncryption); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(pendingQueue); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/EstablishmentState.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/EstablishmentState.java new file mode 100644 index 00000000..f63687e9 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/EstablishmentState.java @@ -0,0 +1,17 @@ +package com.offlineprotocol.sdk; + + + +public enum EstablishmentState { + NO_KEY_PACKAGE, + HAVE_KEY_PACKAGE, + SESSION_PENDING, + SESSION_CONFIRMED; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/EventCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/EventCallback.java new file mode 100644 index 00000000..d6f2f037 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/EventCallback.java @@ -0,0 +1,6 @@ +package com.offlineprotocol.sdk; + +public interface EventCallback { + public void onEvent(java.lang.String eventJson); + +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverter.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverter.java new file mode 100644 index 00000000..bf02a314 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverter.java @@ -0,0 +1,67 @@ +package com.offlineprotocol.sdk; + + +// The FfiConverter interface handles converter types to and from the FFI +// +// All implementing objects should be public to support external types. When a +// type is external we need to import it's FfiConverter. +public interface FfiConverter { + // Convert an FFI type to a Java type + JavaType lift(FfiType value); + + // Convert an Java type to an FFI type + FfiType lower(JavaType value); + + // Read a Java type from a `ByteBuffer` + JavaType read(java.nio.ByteBuffer buf); + + // Calculate bytes to allocate when creating a `RustBuffer` + // + // This must return at least as many bytes as the write() function will + // write. It can return more bytes than needed, for example when writing + // Strings we can't know the exact bytes needed until we the UTF-8 + // encoding, so we pessimistically allocate the largest size possible (3 + // bytes per codepoint). Allocating extra bytes is not really a big deal + // because the `RustBuffer` is short-lived. + long allocationSize(JavaType value); + + // Write a Java type to a `ByteBuffer` + void write(JavaType value, java.nio.ByteBuffer buf); + + // Lower a value into a `RustBuffer` + // + // This method lowers a value into a `RustBuffer` rather than the normal + // FfiType. It's used by the callback interface code. Callback interface + // returns are always serialized into a `RustBuffer` regardless of their + // normal FFI type. + default java.lang.foreign.MemorySegment lowerIntoRustBuffer(JavaType value) { + java.lang.foreign.MemorySegment rbuf = RustBuffer.alloc(allocationSize(value)); + try { + java.nio.ByteBuffer bbuf = RustBuffer.asWriteByteBuffer(rbuf); + write(value, bbuf); + RustBuffer.setLen(rbuf, (long) bbuf.position()); + return rbuf; + } catch (java.lang.Throwable e) { + RustBuffer.free(rbuf); + throw e; + } + } + + // Lift a value from a `RustBuffer`. + // + // This here mostly because of the symmetry with `lowerIntoRustBuffer()`. + // It's currently only used by the `FfiConverterRustBuffer` class below. + default JavaType liftFromRustBuffer(java.lang.foreign.MemorySegment rbuf) { + java.nio.ByteBuffer byteBuf = RustBuffer.asByteBuffer(rbuf); + try { + JavaType item = read(byteBuf); + if (byteBuf.hasRemaining()) { + throw new java.lang.RuntimeException("junk remaining in buffer after lifting, something is very wrong!!"); + } + return item; + } finally { + RustBuffer.free(rbuf); + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterBoolean.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterBoolean.java new file mode 100644 index 00000000..d140a88d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterBoolean.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterBoolean implements FfiConverter { + INSTANCE; + + @Override + public java.lang.Boolean lift(java.lang.Byte value) { + return (int) value != 0; + } + + @Override + public java.lang.Boolean read(java.nio.ByteBuffer buf) { + return lift(buf.get()); + } + + @Override + public java.lang.Byte lower(java.lang.Boolean value) { + return value ? (byte) 1 : (byte) 0; + } + + @Override + public long allocationSize(java.lang.Boolean value) { + return 1L; + } + + @Override + public void write(java.lang.Boolean value, java.nio.ByteBuffer buf) { + buf.put(lower(value)); + } +} \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByRefBytes.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByRefBytes.java new file mode 100644 index 00000000..07a60d62 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByRefBytes.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + + +// Lowers `&[u8]` / `[ByRef] bytes` arguments, which Rust borrows for the duration of the call +// rather than taking ownership of a RustBuffer. +// +// Only `lower` is reachable: zero-copy bytes flow foreign -> Rust in argument position only, so a +// borrow can never be lifted or serialized. `FfiConverter` is implemented anyway so the compiler +// enforces the full set. +// +// The buffer must not be mutated by another thread while a call is in flight, since Rust is reading +// it directly. +public enum FfiConverterByRefBytes implements FfiConverter { + INSTANCE; + + // The struct is read by Rust during the call, so each one needs its own slice; see + // UniffiSlabAllocator. + private static final UniffiSlabAllocator ALLOCATOR = new UniffiSlabAllocator(ForeignBytes.LAYOUT, 1024); + + @Override + public java.lang.foreign.MemorySegment lower(java.nio.ByteBuffer value) { + if (!value.isDirect()) { + throw new java.lang.IllegalArgumentException( + "UniFFI zero-copy &[u8] requires a direct ByteBuffer, so Rust can borrow it without " + + "a copy. Convert with: ByteBuffer.allocateDirect(arr.length).put(arr).flip()"); + } + java.lang.foreign.MemorySegment fb = ALLOCATOR.allocate(ForeignBytes.LAYOUT); + int remaining = value.remaining(); + ForeignBytes.setLen(fb, remaining); + // A zero-length direct buffer has no meaningful address; Rust reads (null, 0) as `&[]`. + // Otherwise ofBuffer honours position/limit, so Rust sees exactly the remaining slice. + ForeignBytes.setData(fb, remaining == 0 + ? java.lang.foreign.MemorySegment.NULL + : java.lang.foreign.MemorySegment.ofBuffer(value)); + return fb; + } + + @Override + public java.nio.ByteBuffer lift(java.lang.foreign.MemorySegment value) { + throw new java.lang.UnsupportedOperationException( + "ByRef bytes cannot be lifted: zero-copy &[u8] only flows foreign to Rust"); + } + + @Override + public java.nio.ByteBuffer read(java.nio.ByteBuffer buf) { + throw new java.lang.UnsupportedOperationException( + "ByRef bytes cannot be read from a buffer: zero-copy &[u8] is only supported in argument position"); + } + + @Override + public void write(java.nio.ByteBuffer value, java.nio.ByteBuffer buf) { + throw new java.lang.UnsupportedOperationException( + "ByRef bytes cannot be written to a buffer: zero-copy &[u8] is only supported in argument position"); + } + + @Override + public long allocationSize(java.nio.ByteBuffer value) { + throw new java.lang.UnsupportedOperationException( + "ByRef bytes have no RustBuffer allocation size: zero-copy &[u8] is only supported in argument position"); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByte.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByte.java new file mode 100644 index 00000000..2593a7b2 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByte.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterByte implements FfiConverter{ + INSTANCE; + + @Override + public java.lang.Byte lift(java.lang.Byte value) { + return value; + } + + @Override + public java.lang.Byte read(java.nio.ByteBuffer buf) { + return buf.get(); + } + + @Override + public java.lang.Byte lower(java.lang.Byte value) { + return value; + } + + @Override + public long allocationSize(java.lang.Byte value) { + return 1L; + } + + @Override + public void write(java.lang.Byte value, java.nio.ByteBuffer buf) { + buf.put(value); + } +} \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByteArray.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByteArray.java new file mode 100644 index 00000000..7bad9de5 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterByteArray.java @@ -0,0 +1,121 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterByteArray implements FfiConverterRustBuffer{ + INSTANCE; + + @Override + public byte[] read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + byte[] byteArr = new byte[len]; + buf.get(byteArr); + return byteArr; + } + + @Override + public long allocationSize(byte[] value) { + return 4L + (long)value.length; + } + + @Override + public void write(byte[] value, java.nio.ByteBuffer buf) { + buf.putInt(value.length); + buf.put(value); + } +} +// This template implements a class for working with a Rust struct via a handle +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Java handle to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// the Java wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque handle to the underlying Rust struct. +// Method calls need to read this handle from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its handle should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `close` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like `try-with-resources`. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Java method calls executing concurrently with or even after a call to +// `close`, and to handle multiple (possibly concurrent!) calls to `close`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Java object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`java` section of the `uniffi.toml` file, like the Kotlin one](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the handle, there is the +// possibility of a race between a method call and a concurrent call to `close`: +// +// * Thread A starts a method call, reads the value of the handle, but is interrupted +// before it can pass the handle over the FFI to Rust. +// * Thread B calls `close` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read handle value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `close` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `close` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `close` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `close` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `close`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `close` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `close()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `close`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `close`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `close` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterCallbackInterface.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterCallbackInterface.java new file mode 100644 index 00000000..f90c15b6 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterCallbackInterface.java @@ -0,0 +1,43 @@ +package com.offlineprotocol.sdk; + + +public abstract class FfiConverterCallbackInterface implements FfiConverter { + // Magic number for the Rust proxy to call using the same mechanism as every other method, + // to free the callback once it's dropped by Rust. + static final int IDX_CALLBACK_FREE = 0; + // Callback return codes + static final int UNIFFI_CALLBACK_SUCCESS = 0; + static final int UNIFFI_CALLBACK_ERROR = 1; + static final int UNIFFI_CALLBACK_UNEXPECTED_ERROR = 2; + + public final UniffiHandleMap handleMap = new UniffiHandleMap<>(); + + void drop(long handle) { + handleMap.remove(handle); + } + + @Override + public CallbackInterface lift(java.lang.Long value) { + return handleMap.get(value); + } + + @Override + public CallbackInterface read(java.nio.ByteBuffer buf) { + return lift(buf.getLong()); + } + + @Override + public java.lang.Long lower(CallbackInterface value) { + return handleMap.insert(value); + } + + @Override + public long allocationSize(CallbackInterface value) { + return 8L; + } + + @Override + public void write(CallbackInterface value, java.nio.ByteBuffer buf) { + buf.putLong(lower(value)); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterDouble.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterDouble.java new file mode 100644 index 00000000..ea37b2cb --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterDouble.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterDouble implements FfiConverter{ + INSTANCE; + + @Override + public java.lang.Double lift(java.lang.Double value) { + return value; + } + + @Override + public java.lang.Double read(java.nio.ByteBuffer buf) { + return buf.getDouble(); + } + + @Override + public java.lang.Double lower(java.lang.Double value) { + return value; + } + + @Override + public long allocationSize(java.lang.Double value) { + return 8L; + } + + @Override + public void write(java.lang.Double value, java.nio.ByteBuffer buf) { + buf.putDouble(value); + } +} \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterFloat.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterFloat.java new file mode 100644 index 00000000..a5e6bbdc --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterFloat.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterFloat implements FfiConverter{ + INSTANCE; + + @Override + public java.lang.Float lift(java.lang.Float value) { + return value; + } + + @Override + public java.lang.Float read(java.nio.ByteBuffer buf) { + return buf.getFloat(); + } + + @Override + public java.lang.Float lower(java.lang.Float value) { + return value; + } + + @Override + public long allocationSize(java.lang.Float value) { + return 4L; + } + + @Override + public void write(java.lang.Float value, java.nio.ByteBuffer buf) { + buf.putFloat(value); + } +} \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterInteger.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterInteger.java new file mode 100644 index 00000000..8f2da05d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterInteger.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterInteger implements FfiConverter{ + INSTANCE; + + @Override + public java.lang.Integer lift(java.lang.Integer value) { + return value; + } + + @Override + public java.lang.Integer read(java.nio.ByteBuffer buf) { + return buf.getInt(); + } + + @Override + public java.lang.Integer lower(java.lang.Integer value) { + return value; + } + + @Override + public long allocationSize(java.lang.Integer value) { + return 4L; + } + + @Override + public void write(java.lang.Integer value, java.nio.ByteBuffer buf) { + buf.putInt(value); + } +} \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterLong.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterLong.java new file mode 100644 index 00000000..210f1b63 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterLong.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterLong implements FfiConverter { + INSTANCE; + + @Override + public java.lang.Long lift(java.lang.Long value) { + return value; + } + + @Override + public java.lang.Long read(java.nio.ByteBuffer buf) { + return buf.getLong(); + } + + @Override + public java.lang.Long lower(java.lang.Long value) { + return value; + } + + @Override + public long allocationSize(java.lang.Long value) { + return 8L; + } + + @Override + public void write(java.lang.Long value, java.nio.ByteBuffer buf) { + buf.putLong(value); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterMapStringString.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterMapStringString.java new file mode 100644 index 00000000..d99f1e6b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterMapStringString.java @@ -0,0 +1,45 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterMapStringString implements FfiConverterRustBuffer> { + INSTANCE; + + @Override + public java.util.Map read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + // Collectors.toMap would be preferred here, but theres a bug that doesn't allow + // null values in the map, even though that is valid Java + return java.util.stream.IntStream.range(0, len).boxed().collect( + java.util.HashMap::new, + (m, _v) -> m.put( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf) + ), + java.util.HashMap::putAll + ); + } + + @Override + public long allocationSize(java.util.Map value) { + long spaceForMapSize = 4; + long spaceForChildren = value.entrySet().stream().mapToLong(entry -> + FfiConverterString.INSTANCE.allocationSize(entry.getKey()) + + FfiConverterString.INSTANCE.allocationSize(entry.getValue()) + ).sum(); + return spaceForMapSize + spaceForChildren; + } + + @Override + public void write(java.util.Map value, java.nio.ByteBuffer buf) { + buf.putInt(value.size()); + // The parens on `(k, v)` here ensure we're calling the right method, + // which is important for compatibility with older android devices. + // Ref https://blog.danlew.net/2017/03/16/kotlin-puzzler-whose-line-is-it-anyways/ + for (var entry : value.entrySet()) { + FfiConverterString.INSTANCE.write(entry.getKey(), buf); + FfiConverterString.INSTANCE.write(entry.getValue(), buf); + } + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalBoolean.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalBoolean.java new file mode 100644 index 00000000..45bb24df --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalBoolean.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalBoolean implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public java.lang.Boolean read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterBoolean.INSTANCE.read(buf); + } + + @Override + public long allocationSize(java.lang.Boolean value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterBoolean.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(java.lang.Boolean value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterBoolean.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalByte.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalByte.java new file mode 100644 index 00000000..986f0749 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalByte.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalByte implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public java.lang.Byte read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterByte.INSTANCE.read(buf); + } + + @Override + public long allocationSize(java.lang.Byte value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterByte.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(java.lang.Byte value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterByte.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalByteArray.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalByteArray.java new file mode 100644 index 00000000..36850193 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalByteArray.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalByteArray implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public byte[] read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterByteArray.INSTANCE.read(buf); + } + + @Override + public long allocationSize(byte[] value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterByteArray.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(byte[] value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterByteArray.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalFloat.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalFloat.java new file mode 100644 index 00000000..5e485924 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalFloat.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalFloat implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public java.lang.Float read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterFloat.INSTANCE.read(buf); + } + + @Override + public long allocationSize(java.lang.Float value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterFloat.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(java.lang.Float value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterFloat.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalInteger.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalInteger.java new file mode 100644 index 00000000..41f67bce --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalInteger.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalInteger implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public java.lang.Integer read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterInteger.INSTANCE.read(buf); + } + + @Override + public long allocationSize(java.lang.Integer value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterInteger.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(java.lang.Integer value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterInteger.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalLong.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalLong.java new file mode 100644 index 00000000..48a52859 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalLong.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalLong implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public java.lang.Long read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterLong.INSTANCE.read(buf); + } + + @Override + public long allocationSize(java.lang.Long value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterLong.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(java.lang.Long value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterLong.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalSequenceByte.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalSequenceByte.java new file mode 100644 index 00000000..5c4e1bff --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalSequenceByte.java @@ -0,0 +1,35 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalSequenceByte implements FfiConverterRustBuffer> { + INSTANCE; + + @Override + public java.util.List read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterSequenceByte.INSTANCE.read(buf); + } + + @Override + public long allocationSize(java.util.List value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterSequenceByte.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(java.util.List value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterSequenceByte.INSTANCE.write(value, buf); + } + } +} +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalShort.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalShort.java new file mode 100644 index 00000000..ddd76dc8 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalShort.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalShort implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public java.lang.Short read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterShort.INSTANCE.read(buf); + } + + @Override + public long allocationSize(java.lang.Short value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterShort.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(java.lang.Short value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterShort.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalString.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalString.java new file mode 100644 index 00000000..2e875bbd --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalString.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalString implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public java.lang.String read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterString.INSTANCE.read(buf); + } + + @Override + public long allocationSize(java.lang.String value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterString.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(java.lang.String value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterString.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeBleFragment.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeBleFragment.java new file mode 100644 index 00000000..b49b8ac8 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeBleFragment.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeBleFragment implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public BleFragment read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeBleFragment.INSTANCE.read(buf); + } + + @Override + public long allocationSize(BleFragment value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeBleFragment.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(BleFragment value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeBleFragment.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeContentType.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeContentType.java new file mode 100644 index 00000000..71449602 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeContentType.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeContentType implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ContentType read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeContentType.INSTANCE.read(buf); + } + + @Override + public long allocationSize(ContentType value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeContentType.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(ContentType value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeContentType.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeCustodyConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeCustodyConfig.java new file mode 100644 index 00000000..bf591df7 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeCustodyConfig.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeCustodyConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public CustodyConfig read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeCustodyConfig.INSTANCE.read(buf); + } + + @Override + public long allocationSize(CustodyConfig value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeCustodyConfig.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(CustodyConfig value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeCustodyConfig.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeFileProgress.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeFileProgress.java new file mode 100644 index 00000000..2d8cbac5 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeFileProgress.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeFileProgress implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public FileProgress read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeFileProgress.INSTANCE.read(buf); + } + + @Override + public long allocationSize(FileProgress value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeFileProgress.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(FileProgress value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeFileProgress.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeForwardInfo.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeForwardInfo.java new file mode 100644 index 00000000..59fbf412 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeForwardInfo.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeForwardInfo implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ForwardInfo read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeForwardInfo.INSTANCE.read(buf); + } + + @Override + public long allocationSize(ForwardInfo value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeForwardInfo.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(ForwardInfo value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeForwardInfo.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeInternetMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeInternetMessage.java new file mode 100644 index 00000000..559c0f11 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeInternetMessage.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeInternetMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public InternetMessage read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeInternetMessage.INSTANCE.read(buf); + } + + @Override + public long allocationSize(InternetMessage value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeInternetMessage.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(InternetMessage value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeInternetMessage.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMediaMetadata.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMediaMetadata.java new file mode 100644 index 00000000..a9bf9a2e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMediaMetadata.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeMediaMetadata implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MediaMetadata read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeMediaMetadata.INSTANCE.read(buf); + } + + @Override + public long allocationSize(MediaMetadata value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeMediaMetadata.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(MediaMetadata value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeMediaMetadata.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMeshRelayConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMeshRelayConfig.java new file mode 100644 index 00000000..baa14366 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMeshRelayConfig.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeMeshRelayConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MeshRelayConfig read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeMeshRelayConfig.INSTANCE.read(buf); + } + + @Override + public long allocationSize(MeshRelayConfig value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeMeshRelayConfig.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(MeshRelayConfig value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeMeshRelayConfig.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMessagePriority.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMessagePriority.java new file mode 100644 index 00000000..f3460381 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMessagePriority.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeMessagePriority implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MessagePriority read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeMessagePriority.INSTANCE.read(buf); + } + + @Override + public long allocationSize(MessagePriority value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeMessagePriority.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(MessagePriority value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeMessagePriority.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsGroupInfo.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsGroupInfo.java new file mode 100644 index 00000000..2bd448a2 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsGroupInfo.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeMlsGroupInfo implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsGroupInfo read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeMlsGroupInfo.INSTANCE.read(buf); + } + + @Override + public long allocationSize(MlsGroupInfo value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeMlsGroupInfo.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(MlsGroupInfo value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeMlsGroupInfo.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsVerbosity.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsVerbosity.java new file mode 100644 index 00000000..4e188282 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsVerbosity.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeMlsVerbosity implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsVerbosity read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeMlsVerbosity.INSTANCE.read(buf); + } + + @Override + public long allocationSize(MlsVerbosity value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeMlsVerbosity.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(MlsVerbosity value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeMlsVerbosity.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsWelcomeMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsWelcomeMessage.java new file mode 100644 index 00000000..496f2cca --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeMlsWelcomeMessage.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeMlsWelcomeMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsWelcomeMessage read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeMlsWelcomeMessage.INSTANCE.read(buf); + } + + @Override + public long allocationSize(MlsWelcomeMessage value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeMlsWelcomeMessage.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(MlsWelcomeMessage value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeMlsWelcomeMessage.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeNostrMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeNostrMessage.java new file mode 100644 index 00000000..a1a83df3 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeNostrMessage.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeNostrMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public NostrMessage read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeNostrMessage.INSTANCE.read(buf); + } + + @Override + public long allocationSize(NostrMessage value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeNostrMessage.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(NostrMessage value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeNostrMessage.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeNostrQuery.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeNostrQuery.java new file mode 100644 index 00000000..662d7999 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeNostrQuery.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeNostrQuery implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public NostrQuery read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeNostrQuery.INSTANCE.read(buf); + } + + @Override + public long allocationSize(NostrQuery value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeNostrQuery.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(NostrQuery value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeNostrQuery.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeOverflowPolicy.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeOverflowPolicy.java new file mode 100644 index 00000000..0c3512c4 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeOverflowPolicy.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeOverflowPolicy implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public OverflowPolicy read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeOverflowPolicy.INSTANCE.read(buf); + } + + @Override + public long allocationSize(OverflowPolicy value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeOverflowPolicy.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(OverflowPolicy value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeOverflowPolicy.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeReplyContext.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeReplyContext.java new file mode 100644 index 00000000..10148c76 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeReplyContext.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeReplyContext implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ReplyContext read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeReplyContext.INSTANCE.read(buf); + } + + @Override + public long allocationSize(ReplyContext value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeReplyContext.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(ReplyContext value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeReplyContext.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeReticulumMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeReticulumMessage.java new file mode 100644 index 00000000..3e411d15 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeReticulumMessage.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeReticulumMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ReticulumMessage read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeReticulumMessage.INSTANCE.read(buf); + } + + @Override + public long allocationSize(ReticulumMessage value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeReticulumMessage.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(ReticulumMessage value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeReticulumMessage.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeTelemetryStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeTelemetryStats.java new file mode 100644 index 00000000..25521269 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeTelemetryStats.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeTelemetryStats implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public TelemetryStats read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeTelemetryStats.INSTANCE.read(buf); + } + + @Override + public long allocationSize(TelemetryStats value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeTelemetryStats.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(TelemetryStats value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeTelemetryStats.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeTransportMetrics.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeTransportMetrics.java new file mode 100644 index 00000000..238257e4 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeTransportMetrics.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeTransportMetrics implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public TransportMetrics read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeTransportMetrics.INSTANCE.read(buf); + } + + @Override + public long allocationSize(TransportMetrics value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeTransportMetrics.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(TransportMetrics value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeTransportMetrics.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeWifiDirectMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeWifiDirectMessage.java new file mode 100644 index 00000000..677292fa --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterOptionalTypeWifiDirectMessage.java @@ -0,0 +1,32 @@ +package com.offlineprotocol.sdk; + +public enum FfiConverterOptionalTypeWifiDirectMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public WifiDirectMessage read(java.nio.ByteBuffer buf) { + if (buf.get() == (byte)0) { + return null; + } + return FfiConverterTypeWifiDirectMessage.INSTANCE.read(buf); + } + + @Override + public long allocationSize(WifiDirectMessage value) { + if (value == null) { + return 1L; + } else { + return 1L + FfiConverterTypeWifiDirectMessage.INSTANCE.allocationSize(value); + } + } + + @Override + public void write(WifiDirectMessage value, java.nio.ByteBuffer buf) { + if (value == null) { + buf.put((byte)0); + } else { + buf.put((byte)1); + FfiConverterTypeWifiDirectMessage.INSTANCE.write(value, buf); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterRustBuffer.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterRustBuffer.java new file mode 100644 index 00000000..94f63717 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterRustBuffer.java @@ -0,0 +1,14 @@ +package com.offlineprotocol.sdk; + + +// FfiConverter that uses `RustBuffer` as the FfiType +public interface FfiConverterRustBuffer extends FfiConverter { + @Override + default JavaType lift(java.lang.foreign.MemorySegment value) { + return liftFromRustBuffer(value); + } + @Override + default java.lang.foreign.MemorySegment lower(JavaType value) { + return lowerIntoRustBuffer(value); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceByte.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceByte.java new file mode 100644 index 00000000..b4230055 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceByte.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterSequenceByte implements FfiConverterRustBuffer> { + INSTANCE; + + @Override + public java.util.List read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + return java.util.stream.IntStream.range(0, len).mapToObj(_i -> FfiConverterByte.INSTANCE.read(buf)).toList(); + } + + @Override + public long allocationSize(java.util.List value) { + long sizeForLength = 4L; + long sizeForItems = value.stream().mapToLong(inner -> FfiConverterByte.INSTANCE.allocationSize(inner)).sum(); + return sizeForLength + sizeForItems; + } + + @Override + public void write(java.util.List value, java.nio.ByteBuffer buf) { + buf.putInt(value.size()); + value.forEach(inner -> FfiConverterByte.INSTANCE.write(inner, buf)); + } +} +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceString.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceString.java new file mode 100644 index 00000000..04732afc --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceString.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterSequenceString implements FfiConverterRustBuffer> { + INSTANCE; + + @Override + public java.util.List read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + return java.util.stream.IntStream.range(0, len).mapToObj(_i -> FfiConverterString.INSTANCE.read(buf)).toList(); + } + + @Override + public long allocationSize(java.util.List value) { + long sizeForLength = 4L; + long sizeForItems = value.stream().mapToLong(inner -> FfiConverterString.INSTANCE.allocationSize(inner)).sum(); + return sizeForLength + sizeForItems; + } + + @Override + public void write(java.util.List value, java.nio.ByteBuffer buf) { + buf.putInt(value.size()); + value.forEach(inner -> FfiConverterString.INSTANCE.write(inner, buf)); + } +} +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeMessageStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeMessageStats.java new file mode 100644 index 00000000..70d4a7de --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeMessageStats.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterSequenceTypeMessageStats implements FfiConverterRustBuffer> { + INSTANCE; + + @Override + public java.util.List read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + return java.util.stream.IntStream.range(0, len).mapToObj(_i -> FfiConverterTypeMessageStats.INSTANCE.read(buf)).toList(); + } + + @Override + public long allocationSize(java.util.List value) { + long sizeForLength = 4L; + long sizeForItems = value.stream().mapToLong(inner -> FfiConverterTypeMessageStats.INSTANCE.allocationSize(inner)).sum(); + return sizeForLength + sizeForItems; + } + + @Override + public void write(java.util.List value, java.nio.ByteBuffer buf) { + buf.putInt(value.size()); + value.forEach(inner -> FfiConverterTypeMessageStats.INSTANCE.write(inner, buf)); + } +} +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeMlsKeyPackageBundle.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeMlsKeyPackageBundle.java new file mode 100644 index 00000000..2c3a0d8a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeMlsKeyPackageBundle.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterSequenceTypeMlsKeyPackageBundle implements FfiConverterRustBuffer> { + INSTANCE; + + @Override + public java.util.List read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + return java.util.stream.IntStream.range(0, len).mapToObj(_i -> FfiConverterTypeMlsKeyPackageBundle.INSTANCE.read(buf)).toList(); + } + + @Override + public long allocationSize(java.util.List value) { + long sizeForLength = 4L; + long sizeForItems = value.stream().mapToLong(inner -> FfiConverterTypeMlsKeyPackageBundle.INSTANCE.allocationSize(inner)).sum(); + return sizeForLength + sizeForItems; + } + + @Override + public void write(java.util.List value, java.nio.ByteBuffer buf) { + buf.putInt(value.size()); + value.forEach(inner -> FfiConverterTypeMlsKeyPackageBundle.INSTANCE.write(inner, buf)); + } +} +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeNetworkLink.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeNetworkLink.java new file mode 100644 index 00000000..b41a5380 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeNetworkLink.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterSequenceTypeNetworkLink implements FfiConverterRustBuffer> { + INSTANCE; + + @Override + public java.util.List read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + return java.util.stream.IntStream.range(0, len).mapToObj(_i -> FfiConverterTypeNetworkLink.INSTANCE.read(buf)).toList(); + } + + @Override + public long allocationSize(java.util.List value) { + long sizeForLength = 4L; + long sizeForItems = value.stream().mapToLong(inner -> FfiConverterTypeNetworkLink.INSTANCE.allocationSize(inner)).sum(); + return sizeForLength + sizeForItems; + } + + @Override + public void write(java.util.List value, java.nio.ByteBuffer buf) { + buf.putInt(value.size()); + value.forEach(inner -> FfiConverterTypeNetworkLink.INSTANCE.write(inner, buf)); + } +} +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeNetworkNode.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeNetworkNode.java new file mode 100644 index 00000000..81063579 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterSequenceTypeNetworkNode.java @@ -0,0 +1,25 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterSequenceTypeNetworkNode implements FfiConverterRustBuffer> { + INSTANCE; + + @Override + public java.util.List read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + return java.util.stream.IntStream.range(0, len).mapToObj(_i -> FfiConverterTypeNetworkNode.INSTANCE.read(buf)).toList(); + } + + @Override + public long allocationSize(java.util.List value) { + long sizeForLength = 4L; + long sizeForItems = value.stream().mapToLong(inner -> FfiConverterTypeNetworkNode.INSTANCE.allocationSize(inner)).sum(); + return sizeForLength + sizeForItems; + } + + @Override + public void write(java.util.List value, java.nio.ByteBuffer buf) { + buf.putInt(value.size()); + value.forEach(inner -> FfiConverterTypeNetworkNode.INSTANCE.write(inner, buf)); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterShort.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterShort.java new file mode 100644 index 00000000..ee857439 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterShort.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterShort implements FfiConverter{ + INSTANCE; + + @Override + public java.lang.Short lift(java.lang.Short value) { + return value; + } + + @Override + public java.lang.Short read(java.nio.ByteBuffer buf) { + return buf.getShort(); + } + + @Override + public java.lang.Short lower(java.lang.Short value) { + return value; + } + + @Override + public long allocationSize(java.lang.Short value) { + return 2L; + } + + @Override + public void write(java.lang.Short value, java.nio.ByteBuffer buf) { + buf.putShort(value); + } +} \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterString.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterString.java new file mode 100644 index 00000000..30dc3b4b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterString.java @@ -0,0 +1,66 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterString implements FfiConverter { + INSTANCE; + + // Note: we don't inherit from FfiConverterRustBuffer, because we use a + // special encoding when lowering/lifting. We can use `RustBuffer.len` to + // store our length and avoid writing it out to the buffer. + @Override + public java.lang.String lift(java.lang.foreign.MemorySegment value) { + try { + byte[] byteArr = new byte[(int) RustBuffer.getLen(value)]; + RustBuffer.asByteBuffer(value).get(byteArr); + return new java.lang.String(byteArr, java.nio.charset.StandardCharsets.UTF_8); + } finally { + RustBuffer.free(value); + } + } + + @Override + public java.lang.String read(java.nio.ByteBuffer buf) { + int len = buf.getInt(); + byte[] byteArr = new byte[len]; + buf.get(byteArr); + return new java.lang.String(byteArr, java.nio.charset.StandardCharsets.UTF_8); + } + + private java.nio.ByteBuffer toUtf8(java.lang.String value) { + // Make sure we don't have invalid UTF-16, check for lone surrogates. + java.nio.charset.CharsetEncoder encoder = java.nio.charset.StandardCharsets.UTF_8.newEncoder(); + encoder.onMalformedInput(java.nio.charset.CodingErrorAction.REPORT); + try { + return encoder.encode(java.nio.CharBuffer.wrap(value)); + } catch (java.nio.charset.CharacterCodingException e) { + throw new java.lang.RuntimeException(e); + } + } + + @Override + public java.lang.foreign.MemorySegment lower(java.lang.String value) { + java.nio.ByteBuffer byteBuf = toUtf8(value); + java.lang.foreign.MemorySegment rbuf = RustBuffer.alloc((long) byteBuf.limit()); + RustBuffer.asWriteByteBuffer(rbuf).put(byteBuf); + RustBuffer.setLen(rbuf, (long) byteBuf.limit()); + return rbuf; + } + + // We aren't sure exactly how many bytes our string will be once it's UTF-8 + // encoded. Allocate 3 bytes per UTF-16 code unit which will always be + // enough. + @Override + public long allocationSize(java.lang.String value) { + long sizeForLength = 4L; + long sizeForString = (long) value.length() * 3L; + return sizeForLength + sizeForString; + } + + @Override + public void write(java.lang.String value, java.nio.ByteBuffer buf) { + java.nio.ByteBuffer byteBuf = toUtf8(value); + buf.putInt(byteBuf.limit()); + buf.put(byteBuf); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeAckConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeAckConfig.java new file mode 100644 index 00000000..f513c93d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeAckConfig.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeAckConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public AckConfig read(java.nio.ByteBuffer buf) { + return new AckConfig( + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(AckConfig value) { + return ( + FfiConverterLong.INSTANCE.allocationSize(value.defaultTimeoutMs()) + + FfiConverterLong.INSTANCE.allocationSize(value.maxPendingAcks()) + ); + } + + @Override + public void write(AckConfig value, java.nio.ByteBuffer buf) { + FfiConverterLong.INSTANCE.write(value.defaultTimeoutMs(), buf); + FfiConverterLong.INSTANCE.write(value.maxPendingAcks(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeAppState.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeAppState.java new file mode 100644 index 00000000..cb963c6b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeAppState.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeAppState implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public AppState read(java.nio.ByteBuffer buf) { + try { + return AppState.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(AppState value) { + return 4L; + } + + @Override + public void write(AppState value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeBleFragment.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeBleFragment.java new file mode 100644 index 00000000..ac6e8683 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeBleFragment.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeBleFragment implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public BleFragment read(java.nio.ByteBuffer buf) { + return new BleFragment( + FfiConverterString.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(BleFragment value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.recipientId()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.data()) + ); + } + + @Override + public void write(BleFragment value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.recipientId(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.data(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeBleTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeBleTransportCallback.java new file mode 100644 index 00000000..63f18e14 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeBleTransportCallback.java @@ -0,0 +1,10 @@ +package com.offlineprotocol.sdk; + + +// The ffiConverter which transforms the Callbacks in to handles to pass to Rust. +public final class FfiConverterTypeBleTransportCallback extends FfiConverterCallbackInterface { + static final FfiConverterTypeBleTransportCallback INSTANCE = new FfiConverterTypeBleTransportCallback(); + + private FfiConverterTypeBleTransportCallback() {} +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeContentType.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeContentType.java new file mode 100644 index 00000000..1160cc7c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeContentType.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeContentType implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ContentType read(java.nio.ByteBuffer buf) { + try { + return ContentType.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(ContentType value) { + return 4L; + } + + @Override + public void write(ContentType value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeCustodyConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeCustodyConfig.java new file mode 100644 index 00000000..3cf71426 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeCustodyConfig.java @@ -0,0 +1,49 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeCustodyConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public CustodyConfig read(java.nio.ByteBuffer buf) { + return new CustodyConfig( + FfiConverterOptionalBoolean.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalTypeOverflowPolicy.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(CustodyConfig value) { + return ( + FfiConverterOptionalBoolean.INSTANCE.allocationSize(value.enabled()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.holdMs()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.maxEntriesPerDepositor()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.maxBytesPerDepositor()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.maxEntries()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.maxBytes()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.strangerMaxEntries()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.strangerMaxBytes()) + + FfiConverterOptionalTypeOverflowPolicy.INSTANCE.allocationSize(value.overflowPolicy()) + ); + } + + @Override + public void write(CustodyConfig value, java.nio.ByteBuffer buf) { + FfiConverterOptionalBoolean.INSTANCE.write(value.enabled(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.holdMs(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.maxEntriesPerDepositor(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.maxBytesPerDepositor(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.maxEntries(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.maxBytes(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.strangerMaxEntries(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.strangerMaxBytes(), buf); + FfiConverterOptionalTypeOverflowPolicy.INSTANCE.write(value.overflowPolicy(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeCustodyStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeCustodyStats.java new file mode 100644 index 00000000..fe46d1b1 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeCustodyStats.java @@ -0,0 +1,88 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeCustodyStats implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public CustodyStats read(java.nio.ByteBuffer buf) { + return new CustodyStats( + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(CustodyStats value) { + return ( + FfiConverterLong.INSTANCE.allocationSize(value.held()) + + FfiConverterLong.INSTANCE.allocationSize(value.heldBytes()) + + FfiConverterLong.INSTANCE.allocationSize(value.accepted()) + + FfiConverterLong.INSTANCE.allocationSize(value.delivered()) + + FfiConverterLong.INSTANCE.allocationSize(value.reOriginated()) + + FfiConverterLong.INSTANCE.allocationSize(value.expired()) + + FfiConverterLong.INSTANCE.allocationSize(value.duplicates()) + + FfiConverterLong.INSTANCE.allocationSize(value.evicted()) + + FfiConverterLong.INSTANCE.allocationSize(value.receiptsSent()) + + FfiConverterLong.INSTANCE.allocationSize(value.receiptsDropped()) + + FfiConverterLong.INSTANCE.allocationSize(value.receiptsReceived()) + + FfiConverterLong.INSTANCE.allocationSize(value.receiptsIgnored()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedDisabled()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedNoRequest()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedUnknownClass()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedNotSealed()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedUnprovenPeer()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedNotDepositor()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedStranger()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedDepositorFull()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedStoreFull()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedBattery()) + ); + } + + @Override + public void write(CustodyStats value, java.nio.ByteBuffer buf) { + FfiConverterLong.INSTANCE.write(value.held(), buf); + FfiConverterLong.INSTANCE.write(value.heldBytes(), buf); + FfiConverterLong.INSTANCE.write(value.accepted(), buf); + FfiConverterLong.INSTANCE.write(value.delivered(), buf); + FfiConverterLong.INSTANCE.write(value.reOriginated(), buf); + FfiConverterLong.INSTANCE.write(value.expired(), buf); + FfiConverterLong.INSTANCE.write(value.duplicates(), buf); + FfiConverterLong.INSTANCE.write(value.evicted(), buf); + FfiConverterLong.INSTANCE.write(value.receiptsSent(), buf); + FfiConverterLong.INSTANCE.write(value.receiptsDropped(), buf); + FfiConverterLong.INSTANCE.write(value.receiptsReceived(), buf); + FfiConverterLong.INSTANCE.write(value.receiptsIgnored(), buf); + FfiConverterLong.INSTANCE.write(value.refusedDisabled(), buf); + FfiConverterLong.INSTANCE.write(value.refusedNoRequest(), buf); + FfiConverterLong.INSTANCE.write(value.refusedUnknownClass(), buf); + FfiConverterLong.INSTANCE.write(value.refusedNotSealed(), buf); + FfiConverterLong.INSTANCE.write(value.refusedUnprovenPeer(), buf); + FfiConverterLong.INSTANCE.write(value.refusedNotDepositor(), buf); + FfiConverterLong.INSTANCE.write(value.refusedStranger(), buf); + FfiConverterLong.INSTANCE.write(value.refusedDepositorFull(), buf); + FfiConverterLong.INSTANCE.write(value.refusedStoreFull(), buf); + FfiConverterLong.INSTANCE.write(value.refusedBattery(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDataStore.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDataStore.java new file mode 100644 index 00000000..fbe31889 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDataStore.java @@ -0,0 +1,131 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeDataStore implements FfiConverter { + INSTANCE; + + @Override + public java.lang.Long lower(DataStore value) { + return value.uniffiCloneHandle(); + } + + @Override + public DataStore lift(java.lang.Long value) { + return new DataStore(UniffiWithHandle.INSTANCE, value); + } + + @Override + public DataStore read(java.nio.ByteBuffer buf) { + // The Rust code always writes handles as 8 bytes, and will + // fail to compile if they don't fit. + return lift(buf.getLong()); + } + + @Override + public long allocationSize(DataStore value) { + return 8L; + } + + @Override + public void write(DataStore value, java.nio.ByteBuffer buf) { + // The Rust code always expects handles written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(lower(value)); + } +} +// This template implements a class for working with a Rust struct via a handle +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Java handle to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// the Java wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque handle to the underlying Rust struct. +// Method calls need to read this handle from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its handle should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `close` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like `try-with-resources`. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Java method calls executing concurrently with or even after a call to +// `close`, and to handle multiple (possibly concurrent!) calls to `close`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Java object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`java` section of the `uniffi.toml` file, like the Kotlin one](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the handle, there is the +// possibility of a race between a method call and a concurrent call to `close`: +// +// * Thread A starts a method call, reads the value of the handle, but is interrupted +// before it can pass the handle over the FFI to Rust. +// * Thread B calls `close` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read handle value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `close` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `close` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `close` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `close` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `close`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `close` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `close()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `close`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `close`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `close` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDedupConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDedupConfig.java new file mode 100644 index 00000000..cf15798d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDedupConfig.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeDedupConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public DedupConfig read(java.nio.ByteBuffer buf) { + return new DedupConfig( + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(DedupConfig value) { + return ( + FfiConverterLong.INSTANCE.allocationSize(value.maxTrackedMessages()) + + FfiConverterLong.INSTANCE.allocationSize(value.retentionTimeSecs()) + ); + } + + @Override + public void write(DedupConfig value, java.nio.ByteBuffer buf) { + FfiConverterLong.INSTANCE.write(value.maxTrackedMessages(), buf); + FfiConverterLong.INSTANCE.write(value.retentionTimeSecs(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDedupStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDedupStats.java new file mode 100644 index 00000000..953e0977 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDedupStats.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeDedupStats implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public DedupStats read(java.nio.ByteBuffer buf) { + return new DedupStats( + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(DedupStats value) { + return ( + FfiConverterLong.INSTANCE.allocationSize(value.totalTracked()) + + FfiConverterLong.INSTANCE.allocationSize(value.recentTracked()) + + FfiConverterByte.INSTANCE.allocationSize(value.capacityUsedPercent()) + + FfiConverterString.INSTANCE.allocationSize(value.mode()) + ); + } + + @Override + public void write(DedupStats value, java.nio.ByteBuffer buf) { + FfiConverterLong.INSTANCE.write(value.totalTracked(), buf); + FfiConverterLong.INSTANCE.write(value.recentTracked(), buf); + FfiConverterByte.INSTANCE.write(value.capacityUsedPercent(), buf); + FfiConverterString.INSTANCE.write(value.mode(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDorsConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDorsConfig.java new file mode 100644 index 00000000..6f0a220c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeDorsConfig.java @@ -0,0 +1,76 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeDorsConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public DorsConfig read(java.nio.ByteBuffer buf) { + return new DorsConfig( + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterShort.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(DorsConfig value) { + return ( + FfiConverterBoolean.INSTANCE.allocationSize(value.preferOnline()) + + FfiConverterFloat.INSTANCE.allocationSize(value.switchHysteresis()) + + FfiConverterLong.INSTANCE.allocationSize(value.switchCooldownSecs()) + + FfiConverterInteger.INSTANCE.allocationSize(value.bleToWifiRetryThreshold()) + + FfiConverterFloat.INSTANCE.allocationSize(value.minSuccessRateBeforeEscalation()) + + FfiConverterLong.INSTANCE.allocationSize(value.minBleSamplesBeforeSuccessRateEscalation()) + + FfiConverterShort.INSTANCE.allocationSize(value.rssiSwitchThreshold()) + + FfiConverterLong.INSTANCE.allocationSize(value.congestionQueueThreshold()) + + FfiConverterLong.INSTANCE.allocationSize(value.stabilityWindowSecs()) + + FfiConverterLong.INSTANCE.allocationSize(value.poorSignalDurationSecs()) + + FfiConverterByte.INSTANCE.allocationSize(value.ttlEscalationThreshold()) + + FfiConverterLong.INSTANCE.allocationSize(value.congestionDurationSecs()) + + FfiConverterLong.INSTANCE.allocationSize(value.ttlEscalationHoldSecs()) + + FfiConverterLong.INSTANCE.allocationSize(value.historyWindowSize()) + + FfiConverterFloat.INSTANCE.allocationSize(value.queueRecoveryRatio()) + + FfiConverterByte.INSTANCE.allocationSize(value.lowBatteryThreshold()) + + FfiConverterByte.INSTANCE.allocationSize(value.relayMinBatteryLevel()) + + FfiConverterByte.INSTANCE.allocationSize(value.relayOptimalConnectionCount()) + ); + } + + @Override + public void write(DorsConfig value, java.nio.ByteBuffer buf) { + FfiConverterBoolean.INSTANCE.write(value.preferOnline(), buf); + FfiConverterFloat.INSTANCE.write(value.switchHysteresis(), buf); + FfiConverterLong.INSTANCE.write(value.switchCooldownSecs(), buf); + FfiConverterInteger.INSTANCE.write(value.bleToWifiRetryThreshold(), buf); + FfiConverterFloat.INSTANCE.write(value.minSuccessRateBeforeEscalation(), buf); + FfiConverterLong.INSTANCE.write(value.minBleSamplesBeforeSuccessRateEscalation(), buf); + FfiConverterShort.INSTANCE.write(value.rssiSwitchThreshold(), buf); + FfiConverterLong.INSTANCE.write(value.congestionQueueThreshold(), buf); + FfiConverterLong.INSTANCE.write(value.stabilityWindowSecs(), buf); + FfiConverterLong.INSTANCE.write(value.poorSignalDurationSecs(), buf); + FfiConverterByte.INSTANCE.write(value.ttlEscalationThreshold(), buf); + FfiConverterLong.INSTANCE.write(value.congestionDurationSecs(), buf); + FfiConverterLong.INSTANCE.write(value.ttlEscalationHoldSecs(), buf); + FfiConverterLong.INSTANCE.write(value.historyWindowSize(), buf); + FfiConverterFloat.INSTANCE.write(value.queueRecoveryRatio(), buf); + FfiConverterByte.INSTANCE.write(value.lowBatteryThreshold(), buf); + FfiConverterByte.INSTANCE.write(value.relayMinBatteryLevel(), buf); + FfiConverterByte.INSTANCE.write(value.relayOptimalConnectionCount(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEncryptionConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEncryptionConfig.java new file mode 100644 index 00000000..499018cd --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEncryptionConfig.java @@ -0,0 +1,37 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeEncryptionConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public EncryptionConfig read(java.nio.ByteBuffer buf) { + return new EncryptionConfig( + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterTypePendingQueueConfig.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(EncryptionConfig value) { + return ( + FfiConverterBoolean.INSTANCE.allocationSize(value.enabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.autoKeyExchange()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.storePending()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.requireEncryption()) + + FfiConverterTypePendingQueueConfig.INSTANCE.allocationSize(value.pendingQueue()) + ); + } + + @Override + public void write(EncryptionConfig value, java.nio.ByteBuffer buf) { + FfiConverterBoolean.INSTANCE.write(value.enabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.autoKeyExchange(), buf); + FfiConverterBoolean.INSTANCE.write(value.storePending(), buf); + FfiConverterBoolean.INSTANCE.write(value.requireEncryption(), buf); + FfiConverterTypePendingQueueConfig.INSTANCE.write(value.pendingQueue(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEstablishmentState.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEstablishmentState.java new file mode 100644 index 00000000..44a63afc --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEstablishmentState.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeEstablishmentState implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public EstablishmentState read(java.nio.ByteBuffer buf) { + try { + return EstablishmentState.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(EstablishmentState value) { + return 4L; + } + + @Override + public void write(EstablishmentState value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEventCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEventCallback.java new file mode 100644 index 00000000..1401ca73 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeEventCallback.java @@ -0,0 +1,10 @@ +package com.offlineprotocol.sdk; + + +// The ffiConverter which transforms the Callbacks in to handles to pass to Rust. +public final class FfiConverterTypeEventCallback extends FfiConverterCallbackInterface { + static final FfiConverterTypeEventCallback INSTANCE = new FfiConverterTypeEventCallback(); + + private FfiConverterTypeEventCallback() {} +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeFileProgress.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeFileProgress.java new file mode 100644 index 00000000..46d77bee --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeFileProgress.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeFileProgress implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public FileProgress read(java.nio.ByteBuffer buf) { + return new FileProgress( + FfiConverterString.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(FileProgress value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.fileId()) + + FfiConverterInteger.INSTANCE.allocationSize(value.chunksSent()) + + FfiConverterInteger.INSTANCE.allocationSize(value.totalChunks()) + + FfiConverterByte.INSTANCE.allocationSize(value.percentage()) + ); + } + + @Override + public void write(FileProgress value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.fileId(), buf); + FfiConverterInteger.INSTANCE.write(value.chunksSent(), buf); + FfiConverterInteger.INSTANCE.write(value.totalChunks(), buf); + FfiConverterByte.INSTANCE.write(value.percentage(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeForwardInfo.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeForwardInfo.java new file mode 100644 index 00000000..8d2c103a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeForwardInfo.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeForwardInfo implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ForwardInfo read(java.nio.ByteBuffer buf) { + return new ForwardInfo( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(ForwardInfo value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.originalSender()) + + FfiConverterString.INSTANCE.allocationSize(value.originalMessageId()) + + FfiConverterLong.INSTANCE.allocationSize(value.originalTimestamp()) + + FfiConverterInteger.INSTANCE.allocationSize(value.forwardCount()) + ); + } + + @Override + public void write(ForwardInfo value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.originalSender(), buf); + FfiConverterString.INSTANCE.write(value.originalMessageId(), buf); + FfiConverterLong.INSTANCE.write(value.originalTimestamp(), buf); + FfiConverterInteger.INSTANCE.write(value.forwardCount(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeGatewayAddressDeclaration.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeGatewayAddressDeclaration.java new file mode 100644 index 00000000..76dd1d74 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeGatewayAddressDeclaration.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeGatewayAddressDeclaration implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public GatewayAddressDeclaration read(java.nio.ByteBuffer buf) { + return new GatewayAddressDeclaration( + FfiConverterString.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(GatewayAddressDeclaration value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.address()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.publicKey()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.signature()) + ); + } + + @Override + public void write(GatewayAddressDeclaration value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.address(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.publicKey(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.signature(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeGroupRichReadiness.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeGroupRichReadiness.java new file mode 100644 index 00000000..5baafb0b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeGroupRichReadiness.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeGroupRichReadiness implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public GroupRichReadiness read(java.nio.ByteBuffer buf) { + return new GroupRichReadiness( + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterSequenceString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(GroupRichReadiness value) { + return ( + FfiConverterBoolean.INSTANCE.allocationSize(value.ready()) + + FfiConverterSequenceString.INSTANCE.allocationSize(value.unknownMembers()) + ); + } + + @Override + public void write(GroupRichReadiness value, java.nio.ByteBuffer buf) { + FfiConverterBoolean.INSTANCE.write(value.ready(), buf); + FfiConverterSequenceString.INSTANCE.write(value.unknownMembers(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeInternetMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeInternetMessage.java new file mode 100644 index 00000000..e0cad8c2 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeInternetMessage.java @@ -0,0 +1,40 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeInternetMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public InternetMessage read(java.nio.ByteBuffer buf) { + return new InternetMessage( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(InternetMessage value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.messageId()) + + FfiConverterString.INSTANCE.allocationSize(value.recipientId()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.data()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.replyToMsg()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.controlOp()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.controlPayload()) + ); + } + + @Override + public void write(InternetMessage value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.messageId(), buf); + FfiConverterString.INSTANCE.write(value.recipientId(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.data(), buf); + FfiConverterOptionalString.INSTANCE.write(value.replyToMsg(), buf); + FfiConverterOptionalString.INSTANCE.write(value.controlOp(), buf); + FfiConverterOptionalString.INSTANCE.write(value.controlPayload(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeInviteInfo.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeInviteInfo.java new file mode 100644 index 00000000..d683fcea --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeInviteInfo.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeInviteInfo implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public InviteInfo read(java.nio.ByteBuffer buf) { + return new InviteInfo( + FfiConverterString.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(InviteInfo value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.address()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.publicKey()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.petname()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.signed()) + ); + } + + @Override + public void write(InviteInfo value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.address(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.publicKey(), buf); + FfiConverterOptionalString.INSTANCE.write(value.petname(), buf); + FfiConverterBoolean.INSTANCE.write(value.signed(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMediaMetadata.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMediaMetadata.java new file mode 100644 index 00000000..2f222a02 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMediaMetadata.java @@ -0,0 +1,70 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMediaMetadata implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MediaMetadata read(java.nio.ByteBuffer buf) { + return new MediaMetadata( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalInteger.INSTANCE.read(buf), + FfiConverterOptionalInteger.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MediaMetadata value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.mimeType()) + + FfiConverterString.INSTANCE.allocationSize(value.fileName()) + + FfiConverterLong.INSTANCE.allocationSize(value.fileSize()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.durationMs()) + + FfiConverterOptionalInteger.INSTANCE.allocationSize(value.width()) + + FfiConverterOptionalInteger.INSTANCE.allocationSize(value.height()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.thumbnailBase64()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.mediaId()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.downloadUrl()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.thumbnailUrl()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.encryptionKey()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.iv()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.ciphertextHash()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.stickerProvider()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.stickerRemoteId()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.stickerKind()) + ); + } + + @Override + public void write(MediaMetadata value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.mimeType(), buf); + FfiConverterString.INSTANCE.write(value.fileName(), buf); + FfiConverterLong.INSTANCE.write(value.fileSize(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.durationMs(), buf); + FfiConverterOptionalInteger.INSTANCE.write(value.width(), buf); + FfiConverterOptionalInteger.INSTANCE.write(value.height(), buf); + FfiConverterOptionalString.INSTANCE.write(value.thumbnailBase64(), buf); + FfiConverterOptionalString.INSTANCE.write(value.mediaId(), buf); + FfiConverterOptionalString.INSTANCE.write(value.downloadUrl(), buf); + FfiConverterOptionalString.INSTANCE.write(value.thumbnailUrl(), buf); + FfiConverterOptionalString.INSTANCE.write(value.encryptionKey(), buf); + FfiConverterOptionalString.INSTANCE.write(value.iv(), buf); + FfiConverterOptionalString.INSTANCE.write(value.ciphertextHash(), buf); + FfiConverterOptionalString.INSTANCE.write(value.stickerProvider(), buf); + FfiConverterOptionalString.INSTANCE.write(value.stickerRemoteId(), buf); + FfiConverterOptionalString.INSTANCE.write(value.stickerKind(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMediaSendOptions.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMediaSendOptions.java new file mode 100644 index 00000000..ea0e7598 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMediaSendOptions.java @@ -0,0 +1,43 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMediaSendOptions implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MediaSendOptions read(java.nio.ByteBuffer buf) { + return new MediaSendOptions( + FfiConverterOptionalTypeMediaMetadata.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalTypeReplyContext.INSTANCE.read(buf), + FfiConverterOptionalTypeForwardInfo.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MediaSendOptions value) { + return ( + FfiConverterOptionalTypeMediaMetadata.INSTANCE.allocationSize(value.mediaMetadata()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.caption()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.replyToMsg()) + + FfiConverterOptionalTypeReplyContext.INSTANCE.allocationSize(value.replyContext()) + + FfiConverterOptionalTypeForwardInfo.INSTANCE.allocationSize(value.forwardInfo()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.fileId()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.appId()) + ); + } + + @Override + public void write(MediaSendOptions value, java.nio.ByteBuffer buf) { + FfiConverterOptionalTypeMediaMetadata.INSTANCE.write(value.mediaMetadata(), buf); + FfiConverterOptionalString.INSTANCE.write(value.caption(), buf); + FfiConverterOptionalString.INSTANCE.write(value.replyToMsg(), buf); + FfiConverterOptionalTypeReplyContext.INSTANCE.write(value.replyContext(), buf); + FfiConverterOptionalTypeForwardInfo.INSTANCE.write(value.forwardInfo(), buf); + FfiConverterOptionalString.INSTANCE.write(value.fileId(), buf); + FfiConverterOptionalString.INSTANCE.write(value.appId(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayConfig.java new file mode 100644 index 00000000..e55ef2ba --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayConfig.java @@ -0,0 +1,70 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMeshRelayConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MeshRelayConfig read(java.nio.ByteBuffer buf) { + return new MeshRelayConfig( + FfiConverterOptionalByte.INSTANCE.read(buf), + FfiConverterOptionalByte.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalInteger.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MeshRelayConfig value) { + return ( + FfiConverterOptionalByte.INSTANCE.allocationSize(value.maxTtl()) + + FfiConverterOptionalByte.INSTANCE.allocationSize(value.denseMaxTtl()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.denseDegree()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.fanout()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.jitterMinMs()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.jitterMaxMs()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.ratePerSec()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.burst()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.peerRatePerSec()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.peerBurst()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.queueCapacity()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.biasMinScale()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.biasMaxHandicapMs()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.activityWindowMs()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.activityMinForwards()) + + FfiConverterOptionalInteger.INSTANCE.allocationSize(value.activityIdleWindows()) + ); + } + + @Override + public void write(MeshRelayConfig value, java.nio.ByteBuffer buf) { + FfiConverterOptionalByte.INSTANCE.write(value.maxTtl(), buf); + FfiConverterOptionalByte.INSTANCE.write(value.denseMaxTtl(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.denseDegree(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.fanout(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.jitterMinMs(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.jitterMaxMs(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.ratePerSec(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.burst(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.peerRatePerSec(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.peerBurst(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.queueCapacity(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.biasMinScale(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.biasMaxHandicapMs(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.activityWindowMs(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.activityMinForwards(), buf); + FfiConverterOptionalInteger.INSTANCE.write(value.activityIdleWindows(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayStats.java new file mode 100644 index 00000000..68f79394 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayStats.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMeshRelayStats implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MeshRelayStats read(java.nio.ByteBuffer buf) { + return new MeshRelayStats( + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MeshRelayStats value) { + return ( + FfiConverterLong.INSTANCE.allocationSize(value.forwarded()) + + FfiConverterLong.INSTANCE.allocationSize(value.transmissions()) + + FfiConverterLong.INSTANCE.allocationSize(value.queued()) + + FfiConverterLong.INSTANCE.allocationSize(value.awaitingTransmission()) + + FfiConverterLong.INSTANCE.allocationSize(value.duplicatesSuppressed()) + + FfiConverterLong.INSTANCE.allocationSize(value.coveredByANeighbor()) + + FfiConverterLong.INSTANCE.allocationSize(value.peerRateLimited()) + + FfiConverterLong.INSTANCE.allocationSize(value.refusedQueueFull()) + + FfiConverterLong.INSTANCE.allocationSize(value.rateDeferred()) + + FfiConverterLong.INSTANCE.allocationSize(value.abandonedOverdue()) + + FfiConverterLong.INSTANCE.allocationSize(value.hopLimitReached()) + + FfiConverterLong.INSTANCE.allocationSize(value.reachClamped()) + + FfiConverterLong.INSTANCE.allocationSize(value.droppedForCapacity()) + ); + } + + @Override + public void write(MeshRelayStats value, java.nio.ByteBuffer buf) { + FfiConverterLong.INSTANCE.write(value.forwarded(), buf); + FfiConverterLong.INSTANCE.write(value.transmissions(), buf); + FfiConverterLong.INSTANCE.write(value.queued(), buf); + FfiConverterLong.INSTANCE.write(value.awaitingTransmission(), buf); + FfiConverterLong.INSTANCE.write(value.duplicatesSuppressed(), buf); + FfiConverterLong.INSTANCE.write(value.coveredByANeighbor(), buf); + FfiConverterLong.INSTANCE.write(value.peerRateLimited(), buf); + FfiConverterLong.INSTANCE.write(value.refusedQueueFull(), buf); + FfiConverterLong.INSTANCE.write(value.rateDeferred(), buf); + FfiConverterLong.INSTANCE.write(value.abandonedOverdue(), buf); + FfiConverterLong.INSTANCE.write(value.hopLimitReached(), buf); + FfiConverterLong.INSTANCE.write(value.reachClamped(), buf); + FfiConverterLong.INSTANCE.write(value.droppedForCapacity(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayTunables.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayTunables.java new file mode 100644 index 00000000..f0c3da34 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshRelayTunables.java @@ -0,0 +1,70 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMeshRelayTunables implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MeshRelayTunables read(java.nio.ByteBuffer buf) { + return new MeshRelayTunables( + FfiConverterByte.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MeshRelayTunables value) { + return ( + FfiConverterByte.INSTANCE.allocationSize(value.maxTtl()) + + FfiConverterByte.INSTANCE.allocationSize(value.denseMaxTtl()) + + FfiConverterLong.INSTANCE.allocationSize(value.denseDegree()) + + FfiConverterLong.INSTANCE.allocationSize(value.fanout()) + + FfiConverterLong.INSTANCE.allocationSize(value.jitterMinMs()) + + FfiConverterLong.INSTANCE.allocationSize(value.jitterMaxMs()) + + FfiConverterFloat.INSTANCE.allocationSize(value.ratePerSec()) + + FfiConverterFloat.INSTANCE.allocationSize(value.burst()) + + FfiConverterFloat.INSTANCE.allocationSize(value.peerRatePerSec()) + + FfiConverterFloat.INSTANCE.allocationSize(value.peerBurst()) + + FfiConverterLong.INSTANCE.allocationSize(value.queueCapacity()) + + FfiConverterFloat.INSTANCE.allocationSize(value.biasMinScale()) + + FfiConverterLong.INSTANCE.allocationSize(value.biasMaxHandicapMs()) + + FfiConverterLong.INSTANCE.allocationSize(value.activityWindowMs()) + + FfiConverterLong.INSTANCE.allocationSize(value.activityMinForwards()) + + FfiConverterInteger.INSTANCE.allocationSize(value.activityIdleWindows()) + ); + } + + @Override + public void write(MeshRelayTunables value, java.nio.ByteBuffer buf) { + FfiConverterByte.INSTANCE.write(value.maxTtl(), buf); + FfiConverterByte.INSTANCE.write(value.denseMaxTtl(), buf); + FfiConverterLong.INSTANCE.write(value.denseDegree(), buf); + FfiConverterLong.INSTANCE.write(value.fanout(), buf); + FfiConverterLong.INSTANCE.write(value.jitterMinMs(), buf); + FfiConverterLong.INSTANCE.write(value.jitterMaxMs(), buf); + FfiConverterFloat.INSTANCE.write(value.ratePerSec(), buf); + FfiConverterFloat.INSTANCE.write(value.burst(), buf); + FfiConverterFloat.INSTANCE.write(value.peerRatePerSec(), buf); + FfiConverterFloat.INSTANCE.write(value.peerBurst(), buf); + FfiConverterLong.INSTANCE.write(value.queueCapacity(), buf); + FfiConverterFloat.INSTANCE.write(value.biasMinScale(), buf); + FfiConverterLong.INSTANCE.write(value.biasMaxHandicapMs(), buf); + FfiConverterLong.INSTANCE.write(value.activityWindowMs(), buf); + FfiConverterLong.INSTANCE.write(value.activityMinForwards(), buf); + FfiConverterInteger.INSTANCE.write(value.activityIdleWindows(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshServices.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshServices.java new file mode 100644 index 00000000..2cf730d7 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMeshServices.java @@ -0,0 +1,131 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMeshServices implements FfiConverter { + INSTANCE; + + @Override + public java.lang.Long lower(MeshServices value) { + return value.uniffiCloneHandle(); + } + + @Override + public MeshServices lift(java.lang.Long value) { + return new MeshServices(UniffiWithHandle.INSTANCE, value); + } + + @Override + public MeshServices read(java.nio.ByteBuffer buf) { + // The Rust code always writes handles as 8 bytes, and will + // fail to compile if they don't fit. + return lift(buf.getLong()); + } + + @Override + public long allocationSize(MeshServices value) { + return 8L; + } + + @Override + public void write(MeshServices value, java.nio.ByteBuffer buf) { + // The Rust code always expects handles written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(lower(value)); + } +} +// This template implements a class for working with a Rust struct via a handle +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Java handle to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// the Java wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque handle to the underlying Rust struct. +// Method calls need to read this handle from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its handle should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `close` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like `try-with-resources`. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Java method calls executing concurrently with or even after a call to +// `close`, and to handle multiple (possibly concurrent!) calls to `close`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Java object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`java` section of the `uniffi.toml` file, like the Kotlin one](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the handle, there is the +// possibility of a race between a method call and a concurrent call to `close`: +// +// * Thread A starts a method call, reads the value of the handle, but is interrupted +// before it can pass the handle over the FFI to Rust. +// * Thread B calls `close` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read handle value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `close` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `close` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `close` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `close` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `close`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `close` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `close()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `close`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `close`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `close` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMessagePriority.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMessagePriority.java new file mode 100644 index 00000000..ab185484 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMessagePriority.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMessagePriority implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MessagePriority read(java.nio.ByteBuffer buf) { + try { + return MessagePriority.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(MessagePriority value) { + return 4L; + } + + @Override + public void write(MessagePriority value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMessageStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMessageStats.java new file mode 100644 index 00000000..b9f42303 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMessageStats.java @@ -0,0 +1,37 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMessageStats implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MessageStats read(java.nio.ByteBuffer buf) { + return new MessageStats( + FfiConverterString.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MessageStats value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.messageId()) + + FfiConverterLong.INSTANCE.allocationSize(value.sentAtMs()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.deliveredAtMs()) + + FfiConverterByte.INSTANCE.allocationSize(value.hopCount()) + + FfiConverterString.INSTANCE.allocationSize(value.status()) + ); + } + + @Override + public void write(MessageStats value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.messageId(), buf); + FfiConverterLong.INSTANCE.write(value.sentAtMs(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.deliveredAtMs(), buf); + FfiConverterByte.INSTANCE.write(value.hopCount(), buf); + FfiConverterString.INSTANCE.write(value.status(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsAddMemberResult.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsAddMemberResult.java new file mode 100644 index 00000000..5276f6c3 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsAddMemberResult.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMlsAddMemberResult implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsAddMemberResult read(java.nio.ByteBuffer buf) { + return new MlsAddMemberResult( + FfiConverterTypeMlsWelcomeMessage.INSTANCE.read(buf), + FfiConverterTypeMlsEncryptedMessage.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MlsAddMemberResult value) { + return ( + FfiConverterTypeMlsWelcomeMessage.INSTANCE.allocationSize(value.welcome()) + + FfiConverterTypeMlsEncryptedMessage.INSTANCE.allocationSize(value.commit()) + ); + } + + @Override + public void write(MlsAddMemberResult value, java.nio.ByteBuffer buf) { + FfiConverterTypeMlsWelcomeMessage.INSTANCE.write(value.welcome(), buf); + FfiConverterTypeMlsEncryptedMessage.INSTANCE.write(value.commit(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsEncryptedMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsEncryptedMessage.java new file mode 100644 index 00000000..f44fc5df --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsEncryptedMessage.java @@ -0,0 +1,40 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMlsEncryptedMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsEncryptedMessage read(java.nio.ByteBuffer buf) { + return new MlsEncryptedMessage( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MlsEncryptedMessage value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.groupId()) + + FfiConverterString.INSTANCE.allocationSize(value.messageType()) + + FfiConverterLong.INSTANCE.allocationSize(value.epoch()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.ciphertext()) + + FfiConverterString.INSTANCE.allocationSize(value.senderId()) + + FfiConverterLong.INSTANCE.allocationSize(value.timestampMs()) + ); + } + + @Override + public void write(MlsEncryptedMessage value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.groupId(), buf); + FfiConverterString.INSTANCE.write(value.messageType(), buf); + FfiConverterLong.INSTANCE.write(value.epoch(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.ciphertext(), buf); + FfiConverterString.INSTANCE.write(value.senderId(), buf); + FfiConverterLong.INSTANCE.write(value.timestampMs(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsGroupInfo.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsGroupInfo.java new file mode 100644 index 00000000..e978cd95 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsGroupInfo.java @@ -0,0 +1,43 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMlsGroupInfo implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsGroupInfo read(java.nio.ByteBuffer buf) { + return new MlsGroupInfo( + FfiConverterString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterSequenceString.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MlsGroupInfo value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.groupId()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.name()) + + FfiConverterSequenceString.INSTANCE.allocationSize(value.members()) + + FfiConverterLong.INSTANCE.allocationSize(value.epoch()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.isSession()) + + FfiConverterLong.INSTANCE.allocationSize(value.createdAtMs()) + + FfiConverterLong.INSTANCE.allocationSize(value.lastActivityMs()) + ); + } + + @Override + public void write(MlsGroupInfo value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.groupId(), buf); + FfiConverterOptionalString.INSTANCE.write(value.name(), buf); + FfiConverterSequenceString.INSTANCE.write(value.members(), buf); + FfiConverterLong.INSTANCE.write(value.epoch(), buf); + FfiConverterBoolean.INSTANCE.write(value.isSession(), buf); + FfiConverterLong.INSTANCE.write(value.createdAtMs(), buf); + FfiConverterLong.INSTANCE.write(value.lastActivityMs(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsKeyPackageBundle.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsKeyPackageBundle.java new file mode 100644 index 00000000..1e7be034 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsKeyPackageBundle.java @@ -0,0 +1,40 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMlsKeyPackageBundle implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsKeyPackageBundle read(java.nio.ByteBuffer buf) { + return new MlsKeyPackageBundle( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MlsKeyPackageBundle value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.packageId()) + + FfiConverterString.INSTANCE.allocationSize(value.userId()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.keyPackageData()) + + FfiConverterLong.INSTANCE.allocationSize(value.createdAtMs()) + + FfiConverterLong.INSTANCE.allocationSize(value.expiresAtMs()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.synced()) + ); + } + + @Override + public void write(MlsKeyPackageBundle value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.packageId(), buf); + FfiConverterString.INSTANCE.write(value.userId(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.keyPackageData(), buf); + FfiConverterLong.INSTANCE.write(value.createdAtMs(), buf); + FfiConverterLong.INSTANCE.write(value.expiresAtMs(), buf); + FfiConverterBoolean.INSTANCE.write(value.synced(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsStorageError.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsStorageError.java new file mode 100644 index 00000000..c162574a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsStorageError.java @@ -0,0 +1,45 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMlsStorageError implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsStorageException read(java.nio.ByteBuffer buf) { + return switch(buf.getInt()) { + case 1 -> new MlsStorageException.StoreFailed(FfiConverterString.INSTANCE.read(buf)); + case 2 -> new MlsStorageException.LoadFailed(FfiConverterString.INSTANCE.read(buf)); + case 3 -> new MlsStorageException.DeleteFailed(FfiConverterString.INSTANCE.read(buf)); + case 4 -> new MlsStorageException.KeyNotFound(FfiConverterString.INSTANCE.read(buf)); + case 5 -> new MlsStorageException.CorruptedData(FfiConverterString.INSTANCE.read(buf)); + default -> throw new java.lang.RuntimeException("invalid error enum value, something is very wrong!!"); + }; + } + + @Override + public long allocationSize(MlsStorageException value) { + return 4L; + } + + @Override + public void write(MlsStorageException value, java.nio.ByteBuffer buf) { + switch(value) { + case MlsStorageException.StoreFailed x -> { + buf.putInt(1); + } + case MlsStorageException.LoadFailed x -> { + buf.putInt(2); + } + case MlsStorageException.DeleteFailed x -> { + buf.putInt(3); + } + case MlsStorageException.KeyNotFound x -> { + buf.putInt(4); + } + case MlsStorageException.CorruptedData x -> { + buf.putInt(5); + } + default -> throw new java.lang.RuntimeException("invalid error enum value, something is very wrong!!"); + }; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsStorageProvider.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsStorageProvider.java new file mode 100644 index 00000000..93a8171d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsStorageProvider.java @@ -0,0 +1,10 @@ +package com.offlineprotocol.sdk; + + +// The ffiConverter which transforms the Callbacks in to handles to pass to Rust. +public final class FfiConverterTypeMlsStorageProvider extends FfiConverterCallbackInterface { + static final FfiConverterTypeMlsStorageProvider INSTANCE = new FfiConverterTypeMlsStorageProvider(); + + private FfiConverterTypeMlsStorageProvider() {} +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsVerbosity.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsVerbosity.java new file mode 100644 index 00000000..97e39046 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsVerbosity.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMlsVerbosity implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsVerbosity read(java.nio.ByteBuffer buf) { + try { + return MlsVerbosity.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(MlsVerbosity value) { + return 4L; + } + + @Override + public void write(MlsVerbosity value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsWelcomeMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsWelcomeMessage.java new file mode 100644 index 00000000..861caa41 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeMlsWelcomeMessage.java @@ -0,0 +1,37 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeMlsWelcomeMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public MlsWelcomeMessage read(java.nio.ByteBuffer buf) { + return new MlsWelcomeMessage( + FfiConverterString.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(MlsWelcomeMessage value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.groupId()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.welcomeData()) + + FfiConverterString.INSTANCE.allocationSize(value.inviterId()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.groupName()) + + FfiConverterLong.INSTANCE.allocationSize(value.timestampMs()) + ); + } + + @Override + public void write(MlsWelcomeMessage value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.groupId(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.welcomeData(), buf); + FfiConverterString.INSTANCE.write(value.inviterId(), buf); + FfiConverterOptionalString.INSTANCE.write(value.groupName(), buf); + FfiConverterLong.INSTANCE.write(value.timestampMs(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkLink.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkLink.java new file mode 100644 index 00000000..428b5bb1 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkLink.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeNetworkLink implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public NetworkLink read(java.nio.ByteBuffer buf) { + return new NetworkLink( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(NetworkLink value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.sourceId()) + + FfiConverterString.INSTANCE.allocationSize(value.targetId()) + + FfiConverterString.INSTANCE.allocationSize(value.transport()) + + FfiConverterFloat.INSTANCE.allocationSize(value.quality()) + ); + } + + @Override + public void write(NetworkLink value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.sourceId(), buf); + FfiConverterString.INSTANCE.write(value.targetId(), buf); + FfiConverterString.INSTANCE.write(value.transport(), buf); + FfiConverterFloat.INSTANCE.write(value.quality(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkNode.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkNode.java new file mode 100644 index 00000000..63b78b82 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkNode.java @@ -0,0 +1,40 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeNetworkNode implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public NetworkNode read(java.nio.ByteBuffer buf) { + return new NetworkNode( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterOptionalShort.INSTANCE.read(buf), + FfiConverterOptionalByte.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(NetworkNode value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.nodeId()) + + FfiConverterString.INSTANCE.allocationSize(value.role()) + + FfiConverterOptionalShort.INSTANCE.allocationSize(value.rssi()) + + FfiConverterOptionalByte.INSTANCE.allocationSize(value.batteryLevel()) + + FfiConverterInteger.INSTANCE.allocationSize(value.connectionCount()) + + FfiConverterLong.INSTANCE.allocationSize(value.lastSeenMs()) + ); + } + + @Override + public void write(NetworkNode value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.nodeId(), buf); + FfiConverterString.INSTANCE.write(value.role(), buf); + FfiConverterOptionalShort.INSTANCE.write(value.rssi(), buf); + FfiConverterOptionalByte.INSTANCE.write(value.batteryLevel(), buf); + FfiConverterInteger.INSTANCE.write(value.connectionCount(), buf); + FfiConverterLong.INSTANCE.write(value.lastSeenMs(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkTopology.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkTopology.java new file mode 100644 index 00000000..8a75c4fe --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNetworkTopology.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeNetworkTopology implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public NetworkTopology read(java.nio.ByteBuffer buf) { + return new NetworkTopology( + FfiConverterSequenceTypeNetworkNode.INSTANCE.read(buf), + FfiConverterSequenceTypeNetworkLink.INSTANCE.read(buf), + FfiConverterSequenceTypeMessageStats.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(NetworkTopology value) { + return ( + FfiConverterSequenceTypeNetworkNode.INSTANCE.allocationSize(value.nodes()) + + FfiConverterSequenceTypeNetworkLink.INSTANCE.allocationSize(value.links()) + + FfiConverterSequenceTypeMessageStats.INSTANCE.allocationSize(value.messageStats()) + ); + } + + @Override + public void write(NetworkTopology value, java.nio.ByteBuffer buf) { + FfiConverterSequenceTypeNetworkNode.INSTANCE.write(value.nodes(), buf); + FfiConverterSequenceTypeNetworkLink.INSTANCE.write(value.links(), buf); + FfiConverterSequenceTypeMessageStats.INSTANCE.write(value.messageStats(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrMessage.java new file mode 100644 index 00000000..7ac380c9 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrMessage.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeNostrMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public NostrMessage read(java.nio.ByteBuffer buf) { + return new NostrMessage( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(NostrMessage value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.messageId()) + + FfiConverterString.INSTANCE.allocationSize(value.eventId()) + + FfiConverterString.INSTANCE.allocationSize(value.eventJson()) + ); + } + + @Override + public void write(NostrMessage value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.messageId(), buf); + FfiConverterString.INSTANCE.write(value.eventId(), buf); + FfiConverterString.INSTANCE.write(value.eventJson(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrQuery.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrQuery.java new file mode 100644 index 00000000..55ba3b90 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrQuery.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeNostrQuery implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public NostrQuery read(java.nio.ByteBuffer buf) { + return new NostrQuery( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(NostrQuery value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.queryId()) + + FfiConverterString.INSTANCE.allocationSize(value.reqJson()) + ); + } + + @Override + public void write(NostrQuery value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.queryId(), buf); + FfiConverterString.INSTANCE.write(value.reqJson(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrTransportCallback.java new file mode 100644 index 00000000..2f1276ba --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeNostrTransportCallback.java @@ -0,0 +1,10 @@ +package com.offlineprotocol.sdk; + + +// The ffiConverter which transforms the Callbacks in to handles to pass to Rust. +public final class FfiConverterTypeNostrTransportCallback extends FfiConverterCallbackInterface { + static final FfiConverterTypeNostrTransportCallback INSTANCE = new FfiConverterTypeNostrTransportCallback(); + + private FfiConverterTypeNostrTransportCallback() {} +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeOfflineProtocol.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeOfflineProtocol.java new file mode 100644 index 00000000..461a65d7 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeOfflineProtocol.java @@ -0,0 +1,35 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeOfflineProtocol implements FfiConverter { + INSTANCE; + + @Override + public java.lang.Long lower(OfflineProtocol value) { + return value.uniffiCloneHandle(); + } + + @Override + public OfflineProtocol lift(java.lang.Long value) { + return new OfflineProtocol(UniffiWithHandle.INSTANCE, value); + } + + @Override + public OfflineProtocol read(java.nio.ByteBuffer buf) { + // The Rust code always writes handles as 8 bytes, and will + // fail to compile if they don't fit. + return lift(buf.getLong()); + } + + @Override + public long allocationSize(OfflineProtocol value) { + return 8L; + } + + @Override + public void write(OfflineProtocol value, java.nio.ByteBuffer buf) { + // The Rust code always expects handles written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(lower(value)); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeOverflowPolicy.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeOverflowPolicy.java new file mode 100644 index 00000000..ff2d7914 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeOverflowPolicy.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeOverflowPolicy implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public OverflowPolicy read(java.nio.ByteBuffer buf) { + try { + return OverflowPolicy.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(OverflowPolicy value) { + return 4L; + } + + @Override + public void write(OverflowPolicy value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePeerDevice.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePeerDevice.java new file mode 100644 index 00000000..2f4b5532 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePeerDevice.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypePeerDevice implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public PeerDevice read(java.nio.ByteBuffer buf) { + return new PeerDevice( + FfiConverterString.INSTANCE.read(buf), + FfiConverterShort.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(PeerDevice value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.peerId()) + + FfiConverterShort.INSTANCE.allocationSize(value.rssi()) + + FfiConverterLong.INSTANCE.allocationSize(value.lastSeenMs()) + ); + } + + @Override + public void write(PeerDevice value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.peerId(), buf); + FfiConverterShort.INSTANCE.write(value.rssi(), buf); + FfiConverterLong.INSTANCE.write(value.lastSeenMs(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePendingQueueConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePendingQueueConfig.java new file mode 100644 index 00000000..38a8567b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePendingQueueConfig.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypePendingQueueConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public PendingQueueConfig read(java.nio.ByteBuffer buf) { + return new PendingQueueConfig( + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterTypeOverflowPolicy.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(PendingQueueConfig value) { + return ( + FfiConverterLong.INSTANCE.allocationSize(value.maxPendingPerPeer()) + + FfiConverterLong.INSTANCE.allocationSize(value.maxPendingGlobal()) + + FfiConverterLong.INSTANCE.allocationSize(value.pendingTtlMs()) + + FfiConverterTypeOverflowPolicy.INSTANCE.allocationSize(value.overflowPolicy()) + ); + } + + @Override + public void write(PendingQueueConfig value, java.nio.ByteBuffer buf) { + FfiConverterLong.INSTANCE.write(value.maxPendingPerPeer(), buf); + FfiConverterLong.INSTANCE.write(value.maxPendingGlobal(), buf); + FfiConverterLong.INSTANCE.write(value.pendingTtlMs(), buf); + FfiConverterTypeOverflowPolicy.INSTANCE.write(value.overflowPolicy(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePresenceStatus.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePresenceStatus.java new file mode 100644 index 00000000..d1ad9404 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypePresenceStatus.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypePresenceStatus implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public PresenceStatus read(java.nio.ByteBuffer buf) { + try { + return PresenceStatus.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(PresenceStatus value) { + return 4L; + } + + @Override + public void write(PresenceStatus value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolConfig.java new file mode 100644 index 00000000..d6a69b56 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolConfig.java @@ -0,0 +1,127 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeProtocolConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ProtocolConfig read(java.nio.ByteBuffer buf) { + return new ProtocolConfig( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterByte.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterTypeOverflowPolicy.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterOptionalTypeMeshRelayConfig.INSTANCE.read(buf), + FfiConverterOptionalTypeCustodyConfig.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(ProtocolConfig value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.appId()) + + FfiConverterString.INSTANCE.allocationSize(value.profile()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.bleEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.wifiDirectEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.internetEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.reticulumEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.nostrEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.preferOnline()) + + FfiConverterByte.INSTANCE.allocationSize(value.initialTtl()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.encryptionEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.autoKeyExchange()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.storePending()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.requireEncryption()) + + FfiConverterLong.INSTANCE.allocationSize(value.maxPendingPerPeer()) + + FfiConverterLong.INSTANCE.allocationSize(value.maxPendingGlobal()) + + FfiConverterLong.INSTANCE.allocationSize(value.pendingTtlMs()) + + FfiConverterTypeOverflowPolicy.INSTANCE.allocationSize(value.overflowPolicy()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.edgeDrivenUnreachableDm()) + + FfiConverterInteger.INSTANCE.allocationSize(value.maxGroupMembers()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.groupRelayEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.groupRelayBroadcastEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.groupEnforceAdminCommits()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.requireTransportIdentity()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.binaryWireEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.nostrSealingEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.nostrColdContactEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.nostrUsernameDiscoveryEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.compactEnvelopeEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.richPayloadEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.cryptoRecoveryEnabled()) + + FfiConverterOptionalTypeMeshRelayConfig.INSTANCE.allocationSize(value.meshRelay()) + + FfiConverterOptionalTypeCustodyConfig.INSTANCE.allocationSize(value.custody()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.dataEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.controlFreshnessEnforced()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.encryptServiceMessages()) + ); + } + + @Override + public void write(ProtocolConfig value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.appId(), buf); + FfiConverterString.INSTANCE.write(value.profile(), buf); + FfiConverterBoolean.INSTANCE.write(value.bleEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.wifiDirectEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.internetEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.reticulumEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.nostrEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.preferOnline(), buf); + FfiConverterByte.INSTANCE.write(value.initialTtl(), buf); + FfiConverterBoolean.INSTANCE.write(value.encryptionEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.autoKeyExchange(), buf); + FfiConverterBoolean.INSTANCE.write(value.storePending(), buf); + FfiConverterBoolean.INSTANCE.write(value.requireEncryption(), buf); + FfiConverterLong.INSTANCE.write(value.maxPendingPerPeer(), buf); + FfiConverterLong.INSTANCE.write(value.maxPendingGlobal(), buf); + FfiConverterLong.INSTANCE.write(value.pendingTtlMs(), buf); + FfiConverterTypeOverflowPolicy.INSTANCE.write(value.overflowPolicy(), buf); + FfiConverterBoolean.INSTANCE.write(value.edgeDrivenUnreachableDm(), buf); + FfiConverterInteger.INSTANCE.write(value.maxGroupMembers(), buf); + FfiConverterBoolean.INSTANCE.write(value.groupRelayEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.groupRelayBroadcastEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.groupEnforceAdminCommits(), buf); + FfiConverterBoolean.INSTANCE.write(value.requireTransportIdentity(), buf); + FfiConverterBoolean.INSTANCE.write(value.binaryWireEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.nostrSealingEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.nostrColdContactEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.nostrUsernameDiscoveryEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.compactEnvelopeEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.richPayloadEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.cryptoRecoveryEnabled(), buf); + FfiConverterOptionalTypeMeshRelayConfig.INSTANCE.write(value.meshRelay(), buf); + FfiConverterOptionalTypeCustodyConfig.INSTANCE.write(value.custody(), buf); + FfiConverterBoolean.INSTANCE.write(value.dataEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.controlFreshnessEnforced(), buf); + FfiConverterBoolean.INSTANCE.write(value.encryptServiceMessages(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolError.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolError.java new file mode 100644 index 00000000..b11e470a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolError.java @@ -0,0 +1,125 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeProtocolError implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ProtocolException read(java.nio.ByteBuffer buf) { + return switch(buf.getInt()) { + case 1 -> new ProtocolException.NotStarted(FfiConverterString.INSTANCE.read(buf)); + case 2 -> new ProtocolException.AlreadyStarted(FfiConverterString.INSTANCE.read(buf)); + case 3 -> new ProtocolException.InvalidConfiguration(FfiConverterString.INSTANCE.read(buf)); + case 4 -> new ProtocolException.SendFailed(FfiConverterString.INSTANCE.read(buf)); + case 5 -> new ProtocolException.NoKeyPackage(FfiConverterString.INSTANCE.read(buf)); + case 6 -> new ProtocolException.SessionNotReady(FfiConverterString.INSTANCE.read(buf)); + case 7 -> new ProtocolException.EncryptFailed(FfiConverterString.INSTANCE.read(buf)); + case 8 -> new ProtocolException.InvalidState(FfiConverterString.INSTANCE.read(buf)); + case 9 -> new ProtocolException.MlsNotInitialized(FfiConverterString.INSTANCE.read(buf)); + case 10 -> new ProtocolException.MlsException(FfiConverterString.INSTANCE.read(buf)); + case 11 -> new ProtocolException.UserBlocked(FfiConverterString.INSTANCE.read(buf)); + case 12 -> new ProtocolException.MediaTransferLimit(FfiConverterString.INSTANCE.read(buf)); + case 13 -> new ProtocolException.LockPoisoned(FfiConverterString.INSTANCE.read(buf)); + case 14 -> new ProtocolException.Other(FfiConverterString.INSTANCE.read(buf)); + case 15 -> new ProtocolException.TransportException(FfiConverterString.INSTANCE.read(buf)); + case 16 -> new ProtocolException.SerializationException(FfiConverterString.INSTANCE.read(buf)); + case 17 -> new ProtocolException.ServiceException(FfiConverterString.INSTANCE.read(buf)); + case 18 -> new ProtocolException.GroupNotFound(FfiConverterString.INSTANCE.read(buf)); + case 19 -> new ProtocolException.PermissionDenied(FfiConverterString.INSTANCE.read(buf)); + case 20 -> new ProtocolException.InvalidArgument(FfiConverterString.INSTANCE.read(buf)); + case 21 -> new ProtocolException.DataDisabled(FfiConverterString.INSTANCE.read(buf)); + case 22 -> new ProtocolException.DataStorageUnavailable(FfiConverterString.INSTANCE.read(buf)); + case 23 -> new ProtocolException.DocTooLarge(FfiConverterString.INSTANCE.read(buf)); + case 24 -> new ProtocolException.DataCorrupted(FfiConverterString.INSTANCE.read(buf)); + case 25 -> new ProtocolException.TelemetryConfigInvalid(FfiConverterString.INSTANCE.read(buf)); + default -> throw new java.lang.RuntimeException("invalid error enum value, something is very wrong!!"); + }; + } + + @Override + public long allocationSize(ProtocolException value) { + return 4L; + } + + @Override + public void write(ProtocolException value, java.nio.ByteBuffer buf) { + switch(value) { + case ProtocolException.NotStarted x -> { + buf.putInt(1); + } + case ProtocolException.AlreadyStarted x -> { + buf.putInt(2); + } + case ProtocolException.InvalidConfiguration x -> { + buf.putInt(3); + } + case ProtocolException.SendFailed x -> { + buf.putInt(4); + } + case ProtocolException.NoKeyPackage x -> { + buf.putInt(5); + } + case ProtocolException.SessionNotReady x -> { + buf.putInt(6); + } + case ProtocolException.EncryptFailed x -> { + buf.putInt(7); + } + case ProtocolException.InvalidState x -> { + buf.putInt(8); + } + case ProtocolException.MlsNotInitialized x -> { + buf.putInt(9); + } + case ProtocolException.MlsException x -> { + buf.putInt(10); + } + case ProtocolException.UserBlocked x -> { + buf.putInt(11); + } + case ProtocolException.MediaTransferLimit x -> { + buf.putInt(12); + } + case ProtocolException.LockPoisoned x -> { + buf.putInt(13); + } + case ProtocolException.Other x -> { + buf.putInt(14); + } + case ProtocolException.TransportException x -> { + buf.putInt(15); + } + case ProtocolException.SerializationException x -> { + buf.putInt(16); + } + case ProtocolException.ServiceException x -> { + buf.putInt(17); + } + case ProtocolException.GroupNotFound x -> { + buf.putInt(18); + } + case ProtocolException.PermissionDenied x -> { + buf.putInt(19); + } + case ProtocolException.InvalidArgument x -> { + buf.putInt(20); + } + case ProtocolException.DataDisabled x -> { + buf.putInt(21); + } + case ProtocolException.DataStorageUnavailable x -> { + buf.putInt(22); + } + case ProtocolException.DocTooLarge x -> { + buf.putInt(23); + } + case ProtocolException.DataCorrupted x -> { + buf.putInt(24); + } + case ProtocolException.TelemetryConfigInvalid x -> { + buf.putInt(25); + } + default -> throw new java.lang.RuntimeException("invalid error enum value, something is very wrong!!"); + }; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolLockDiagnostics.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolLockDiagnostics.java new file mode 100644 index 00000000..1d3c0f1a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolLockDiagnostics.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeProtocolLockDiagnostics implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ProtocolLockDiagnostics read(java.nio.ByteBuffer buf) { + return new ProtocolLockDiagnostics( + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(ProtocolLockDiagnostics value) { + return ( + FfiConverterBoolean.INSTANCE.allocationSize(value.held()) + + FfiConverterString.INSTANCE.allocationSize(value.holderLocation()) + + FfiConverterString.INSTANCE.allocationSize(value.holderThread()) + + FfiConverterLong.INSTANCE.allocationSize(value.heldForMs()) + ); + } + + @Override + public void write(ProtocolLockDiagnostics value, java.nio.ByteBuffer buf) { + FfiConverterBoolean.INSTANCE.write(value.held(), buf); + FfiConverterString.INSTANCE.write(value.holderLocation(), buf); + FfiConverterString.INSTANCE.write(value.holderThread(), buf); + FfiConverterLong.INSTANCE.write(value.heldForMs(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolState.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolState.java new file mode 100644 index 00000000..a6165ada --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolState.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeProtocolState implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ProtocolState read(java.nio.ByteBuffer buf) { + try { + return ProtocolState.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(ProtocolState value) { + return 4L; + } + + @Override + public void write(ProtocolState value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolStateStorageProvider.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolStateStorageProvider.java new file mode 100644 index 00000000..400491e7 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeProtocolStateStorageProvider.java @@ -0,0 +1,10 @@ +package com.offlineprotocol.sdk; + + +// The ffiConverter which transforms the Callbacks in to handles to pass to Rust. +public final class FfiConverterTypeProtocolStateStorageProvider extends FfiConverterCallbackInterface { + static final FfiConverterTypeProtocolStateStorageProvider INSTANCE = new FfiConverterTypeProtocolStateStorageProvider(); + + private FfiConverterTypeProtocolStateStorageProvider() {} +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelayConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelayConfig.java new file mode 100644 index 00000000..f13dadea --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelayConfig.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeRelayConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public RelayConfig read(java.nio.ByteBuffer buf) { + return new RelayConfig( + FfiConverterByte.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterTypeRelayPriority.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(RelayConfig value) { + return ( + FfiConverterByte.INSTANCE.allocationSize(value.minBatteryForRelay()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.allowRelay()) + + FfiConverterTypeRelayPriority.INSTANCE.allocationSize(value.relayPriority()) + ); + } + + @Override + public void write(RelayConfig value, java.nio.ByteBuffer buf) { + FfiConverterByte.INSTANCE.write(value.minBatteryForRelay(), buf); + FfiConverterBoolean.INSTANCE.write(value.allowRelay(), buf); + FfiConverterTypeRelayPriority.INSTANCE.write(value.relayPriority(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelayPriority.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelayPriority.java new file mode 100644 index 00000000..e81d433b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelayPriority.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeRelayPriority implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public RelayPriority read(java.nio.ByteBuffer buf) { + try { + return RelayPriority.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(RelayPriority value) { + return 4L; + } + + @Override + public void write(RelayPriority value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelaySyncState.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelaySyncState.java new file mode 100644 index 00000000..dd30fc35 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRelaySyncState.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeRelaySyncState implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public RelaySyncState read(java.nio.ByteBuffer buf) { + try { + return RelaySyncState.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(RelaySyncState value) { + return 4L; + } + + @Override + public void write(RelaySyncState value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReliabilityConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReliabilityConfig.java new file mode 100644 index 00000000..12d6eeff --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReliabilityConfig.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeReliabilityConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ReliabilityConfig read(java.nio.ByteBuffer buf) { + return new ReliabilityConfig( + FfiConverterTypeAckConfig.INSTANCE.read(buf), + FfiConverterTypeRetryConfig.INSTANCE.read(buf), + FfiConverterTypeDedupConfig.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(ReliabilityConfig value) { + return ( + FfiConverterTypeAckConfig.INSTANCE.allocationSize(value.ack()) + + FfiConverterTypeRetryConfig.INSTANCE.allocationSize(value.retry()) + + FfiConverterTypeDedupConfig.INSTANCE.allocationSize(value.dedup()) + ); + } + + @Override + public void write(ReliabilityConfig value, java.nio.ByteBuffer buf) { + FfiConverterTypeAckConfig.INSTANCE.write(value.ack(), buf); + FfiConverterTypeRetryConfig.INSTANCE.write(value.retry(), buf); + FfiConverterTypeDedupConfig.INSTANCE.write(value.dedup(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReplyContext.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReplyContext.java new file mode 100644 index 00000000..7f34a942 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReplyContext.java @@ -0,0 +1,37 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeReplyContext implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ReplyContext read(java.nio.ByteBuffer buf) { + return new ReplyContext( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(ReplyContext value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.sender()) + + FfiConverterString.INSTANCE.allocationSize(value.text()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.timestamp()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.replyMediaLabel()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.replyContentType()) + ); + } + + @Override + public void write(ReplyContext value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.sender(), buf); + FfiConverterString.INSTANCE.write(value.text(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.timestamp(), buf); + FfiConverterOptionalString.INSTANCE.write(value.replyMediaLabel(), buf); + FfiConverterOptionalString.INSTANCE.write(value.replyContentType(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReticulumMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReticulumMessage.java new file mode 100644 index 00000000..2c5172ce --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReticulumMessage.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeReticulumMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public ReticulumMessage read(java.nio.ByteBuffer buf) { + return new ReticulumMessage( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(ReticulumMessage value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.messageId()) + + FfiConverterString.INSTANCE.allocationSize(value.recipientId()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.data()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.replyToMsg()) + ); + } + + @Override + public void write(ReticulumMessage value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.messageId(), buf); + FfiConverterString.INSTANCE.write(value.recipientId(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.data(), buf); + FfiConverterOptionalString.INSTANCE.write(value.replyToMsg(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReticulumTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReticulumTransportCallback.java new file mode 100644 index 00000000..b0845f6c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeReticulumTransportCallback.java @@ -0,0 +1,10 @@ +package com.offlineprotocol.sdk; + + +// The ffiConverter which transforms the Callbacks in to handles to pass to Rust. +public final class FfiConverterTypeReticulumTransportCallback extends FfiConverterCallbackInterface { + static final FfiConverterTypeReticulumTransportCallback INSTANCE = new FfiConverterTypeReticulumTransportCallback(); + + private FfiConverterTypeReticulumTransportCallback() {} +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRetryConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRetryConfig.java new file mode 100644 index 00000000..c9ffd9bd --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeRetryConfig.java @@ -0,0 +1,43 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeRetryConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public RetryConfig read(java.nio.ByteBuffer buf) { + return new RetryConfig( + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(RetryConfig value) { + return ( + FfiConverterInteger.INSTANCE.allocationSize(value.maxRetries()) + + FfiConverterLong.INSTANCE.allocationSize(value.initialDelayMs()) + + FfiConverterLong.INSTANCE.allocationSize(value.maxDelayMs()) + + FfiConverterFloat.INSTANCE.allocationSize(value.backoffMultiplier()) + + FfiConverterLong.INSTANCE.allocationSize(value.outboxMaxLifetimeMs()) + + FfiConverterLong.INSTANCE.allocationSize(value.pendingMessageMaxLifetimeMs()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.edgeDrivenUnreachableDm()) + ); + } + + @Override + public void write(RetryConfig value, java.nio.ByteBuffer buf) { + FfiConverterInteger.INSTANCE.write(value.maxRetries(), buf); + FfiConverterLong.INSTANCE.write(value.initialDelayMs(), buf); + FfiConverterLong.INSTANCE.write(value.maxDelayMs(), buf); + FfiConverterFloat.INSTANCE.write(value.backoffMultiplier(), buf); + FfiConverterLong.INSTANCE.write(value.outboxMaxLifetimeMs(), buf); + FfiConverterLong.INSTANCE.write(value.pendingMessageMaxLifetimeMs(), buf); + FfiConverterBoolean.INSTANCE.write(value.edgeDrivenUnreachableDm(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeSendMessageOptions.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeSendMessageOptions.java new file mode 100644 index 00000000..17863e33 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeSendMessageOptions.java @@ -0,0 +1,43 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeSendMessageOptions implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public SendMessageOptions read(java.nio.ByteBuffer buf) { + return new SendMessageOptions( + FfiConverterOptionalTypeMessagePriority.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalTypeContentType.INSTANCE.read(buf), + FfiConverterOptionalTypeReplyContext.INSTANCE.read(buf), + FfiConverterOptionalTypeMediaMetadata.INSTANCE.read(buf), + FfiConverterOptionalTypeForwardInfo.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(SendMessageOptions value) { + return ( + FfiConverterOptionalTypeMessagePriority.INSTANCE.allocationSize(value.priority()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.replyToMsg()) + + FfiConverterOptionalTypeContentType.INSTANCE.allocationSize(value.contentType()) + + FfiConverterOptionalTypeReplyContext.INSTANCE.allocationSize(value.replyContext()) + + FfiConverterOptionalTypeMediaMetadata.INSTANCE.allocationSize(value.mediaMetadata()) + + FfiConverterOptionalTypeForwardInfo.INSTANCE.allocationSize(value.forwardInfo()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.appId()) + ); + } + + @Override + public void write(SendMessageOptions value, java.nio.ByteBuffer buf) { + FfiConverterOptionalTypeMessagePriority.INSTANCE.write(value.priority(), buf); + FfiConverterOptionalString.INSTANCE.write(value.replyToMsg(), buf); + FfiConverterOptionalTypeContentType.INSTANCE.write(value.contentType(), buf); + FfiConverterOptionalTypeReplyContext.INSTANCE.write(value.replyContext(), buf); + FfiConverterOptionalTypeMediaMetadata.INSTANCE.write(value.mediaMetadata(), buf); + FfiConverterOptionalTypeForwardInfo.INSTANCE.write(value.forwardInfo(), buf); + FfiConverterOptionalString.INSTANCE.write(value.appId(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryConfig.java new file mode 100644 index 00000000..9178c760 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryConfig.java @@ -0,0 +1,67 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeTelemetryConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public TelemetryConfig read(java.nio.ByteBuffer buf) { + return new TelemetryConfig( + FfiConverterString.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterTypeTelemetryOs.INSTANCE.read(buf), + FfiConverterShort.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalBoolean.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalInteger.INSTANCE.read(buf), + FfiConverterOptionalBoolean.INSTANCE.read(buf), + FfiConverterOptionalBoolean.INSTANCE.read(buf), + FfiConverterOptionalTypeMlsVerbosity.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalBoolean.INSTANCE.read(buf), + FfiConverterOptionalBoolean.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(TelemetryConfig value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.apiKey()) + + FfiConverterString.INSTANCE.allocationSize(value.appId()) + + FfiConverterTypeTelemetryOs.INSTANCE.allocationSize(value.os()) + + FfiConverterShort.INSTANCE.allocationSize(value.osMajor()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.appVersion()) + + FfiConverterOptionalBoolean.INSTANCE.allocationSize(value.debug()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.flushIntervalMs()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.maxBatchBytes()) + + FfiConverterOptionalInteger.INSTANCE.allocationSize(value.maxBufferedRecords()) + + FfiConverterOptionalBoolean.INSTANCE.allocationSize(value.includeDeviceId()) + + FfiConverterOptionalBoolean.INSTANCE.allocationSize(value.scrubIds()) + + FfiConverterOptionalTypeMlsVerbosity.INSTANCE.allocationSize(value.mlsVerbosity()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.metricsCadenceMs()) + + FfiConverterOptionalBoolean.INSTANCE.allocationSize(value.routingDiagnostic()) + + FfiConverterOptionalBoolean.INSTANCE.allocationSize(value.mlsSamplingBypass()) + ); + } + + @Override + public void write(TelemetryConfig value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.apiKey(), buf); + FfiConverterString.INSTANCE.write(value.appId(), buf); + FfiConverterTypeTelemetryOs.INSTANCE.write(value.os(), buf); + FfiConverterShort.INSTANCE.write(value.osMajor(), buf); + FfiConverterOptionalString.INSTANCE.write(value.appVersion(), buf); + FfiConverterOptionalBoolean.INSTANCE.write(value.debug(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.flushIntervalMs(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.maxBatchBytes(), buf); + FfiConverterOptionalInteger.INSTANCE.write(value.maxBufferedRecords(), buf); + FfiConverterOptionalBoolean.INSTANCE.write(value.includeDeviceId(), buf); + FfiConverterOptionalBoolean.INSTANCE.write(value.scrubIds(), buf); + FfiConverterOptionalTypeMlsVerbosity.INSTANCE.write(value.mlsVerbosity(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.metricsCadenceMs(), buf); + FfiConverterOptionalBoolean.INSTANCE.write(value.routingDiagnostic(), buf); + FfiConverterOptionalBoolean.INSTANCE.write(value.mlsSamplingBypass(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryOs.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryOs.java new file mode 100644 index 00000000..7e67bcb2 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryOs.java @@ -0,0 +1,27 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeTelemetryOs implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public TelemetryOs read(java.nio.ByteBuffer buf) { + try { + return TelemetryOs.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(TelemetryOs value) { + return 4L; + } + + @Override + public void write(TelemetryOs value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryStats.java new file mode 100644 index 00000000..37558580 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTelemetryStats.java @@ -0,0 +1,43 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeTelemetryStats implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public TelemetryStats read(java.nio.ByteBuffer buf) { + return new TelemetryStats( + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterLong.INSTANCE.read(buf), + FfiConverterString.INSTANCE.read(buf), + FfiConverterOptionalString.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(TelemetryStats value) { + return ( + FfiConverterLong.INSTANCE.allocationSize(value.buffered()) + + FfiConverterLong.INSTANCE.allocationSize(value.sentEvents()) + + FfiConverterLong.INSTANCE.allocationSize(value.acceptedEvents()) + + FfiConverterLong.INSTANCE.allocationSize(value.dropped()) + + FfiConverterString.INSTANCE.allocationSize(value.sessionId()) + + FfiConverterOptionalString.INSTANCE.allocationSize(value.lastError()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.lastFlushAtMs()) + ); + } + + @Override + public void write(TelemetryStats value, java.nio.ByteBuffer buf) { + FfiConverterLong.INSTANCE.write(value.buffered(), buf); + FfiConverterLong.INSTANCE.write(value.sentEvents(), buf); + FfiConverterLong.INSTANCE.write(value.acceptedEvents(), buf); + FfiConverterLong.INSTANCE.write(value.dropped(), buf); + FfiConverterString.INSTANCE.write(value.sessionId(), buf); + FfiConverterOptionalString.INSTANCE.write(value.lastError(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.lastFlushAtMs(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportConfig.java new file mode 100644 index 00000000..b5438f4c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportConfig.java @@ -0,0 +1,46 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeTransportConfig implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public TransportConfig read(java.nio.ByteBuffer buf) { + return new TransportConfig( + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf), + FfiConverterBoolean.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(TransportConfig value) { + return ( + FfiConverterBoolean.INSTANCE.allocationSize(value.bleEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.wifiDirectEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.internetEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.reticulumEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.nostrEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.nostrSealingEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.nostrColdContactEnabled()) + + FfiConverterBoolean.INSTANCE.allocationSize(value.nostrUsernameDiscoveryEnabled()) + ); + } + + @Override + public void write(TransportConfig value, java.nio.ByteBuffer buf) { + FfiConverterBoolean.INSTANCE.write(value.bleEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.wifiDirectEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.internetEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.reticulumEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.nostrEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.nostrSealingEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.nostrColdContactEnabled(), buf); + FfiConverterBoolean.INSTANCE.write(value.nostrUsernameDiscoveryEnabled(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportMetrics.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportMetrics.java new file mode 100644 index 00000000..5d08fdb0 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportMetrics.java @@ -0,0 +1,76 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeTransportMetrics implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public TransportMetrics read(java.nio.ByteBuffer buf) { + return new TransportMetrics( + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterFloat.INSTANCE.read(buf), + FfiConverterInteger.INSTANCE.read(buf), + FfiConverterOptionalShort.INSTANCE.read(buf), + FfiConverterOptionalLong.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalInteger.INSTANCE.read(buf), + FfiConverterOptionalByte.INSTANCE.read(buf), + FfiConverterOptionalBoolean.INSTANCE.read(buf), + FfiConverterOptionalByte.INSTANCE.read(buf), + FfiConverterOptionalBoolean.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf), + FfiConverterOptionalFloat.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(TransportMetrics value) { + return ( + FfiConverterInteger.INSTANCE.allocationSize(value.packetsSent()) + + FfiConverterInteger.INSTANCE.allocationSize(value.packetsReceived()) + + FfiConverterInteger.INSTANCE.allocationSize(value.bytesSent()) + + FfiConverterInteger.INSTANCE.allocationSize(value.bytesReceived()) + + FfiConverterFloat.INSTANCE.allocationSize(value.errorRate()) + + FfiConverterInteger.INSTANCE.allocationSize(value.avgLatencyMs()) + + FfiConverterOptionalShort.INSTANCE.allocationSize(value.rssi()) + + FfiConverterOptionalLong.INSTANCE.allocationSize(value.bandwidthBps()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.congestion()) + + FfiConverterOptionalInteger.INSTANCE.allocationSize(value.queueDepth()) + + FfiConverterOptionalByte.INSTANCE.allocationSize(value.batteryLevel()) + + FfiConverterOptionalBoolean.INSTANCE.allocationSize(value.isCharging()) + + FfiConverterOptionalByte.INSTANCE.allocationSize(value.relayConnectionCount()) + + FfiConverterOptionalBoolean.INSTANCE.allocationSize(value.isActiveRelay()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.deliveryRatio()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.dropRate()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.averageHopCount()) + + FfiConverterOptionalFloat.INSTANCE.allocationSize(value.energyCost()) + ); + } + + @Override + public void write(TransportMetrics value, java.nio.ByteBuffer buf) { + FfiConverterInteger.INSTANCE.write(value.packetsSent(), buf); + FfiConverterInteger.INSTANCE.write(value.packetsReceived(), buf); + FfiConverterInteger.INSTANCE.write(value.bytesSent(), buf); + FfiConverterInteger.INSTANCE.write(value.bytesReceived(), buf); + FfiConverterFloat.INSTANCE.write(value.errorRate(), buf); + FfiConverterInteger.INSTANCE.write(value.avgLatencyMs(), buf); + FfiConverterOptionalShort.INSTANCE.write(value.rssi(), buf); + FfiConverterOptionalLong.INSTANCE.write(value.bandwidthBps(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.congestion(), buf); + FfiConverterOptionalInteger.INSTANCE.write(value.queueDepth(), buf); + FfiConverterOptionalByte.INSTANCE.write(value.batteryLevel(), buf); + FfiConverterOptionalBoolean.INSTANCE.write(value.isCharging(), buf); + FfiConverterOptionalByte.INSTANCE.write(value.relayConnectionCount(), buf); + FfiConverterOptionalBoolean.INSTANCE.write(value.isActiveRelay(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.deliveryRatio(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.dropRate(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.averageHopCount(), buf); + FfiConverterOptionalFloat.INSTANCE.write(value.energyCost(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportType.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportType.java new file mode 100644 index 00000000..095e11f0 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeTransportType.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeTransportType implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public TransportType read(java.nio.ByteBuffer buf) { + try { + return TransportType.values()[buf.getInt() - 1]; + } catch (java.lang.IndexOutOfBoundsException e) { + throw new java.lang.RuntimeException("invalid enum value, something is very wrong!!", e); + } + } + + @Override + public long allocationSize(TransportType value) { + return 4L; + } + + @Override + public void write(TransportType value, java.nio.ByteBuffer buf) { + buf.putInt(value.ordinal() + 1); + } +} + + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeWifiDirectMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeWifiDirectMessage.java new file mode 100644 index 00000000..8444b2cc --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeWifiDirectMessage.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public enum FfiConverterTypeWifiDirectMessage implements FfiConverterRustBuffer { + INSTANCE; + + @Override + public WifiDirectMessage read(java.nio.ByteBuffer buf) { + return new WifiDirectMessage( + FfiConverterString.INSTANCE.read(buf), + FfiConverterSequenceByte.INSTANCE.read(buf) + ); + } + + @Override + public long allocationSize(WifiDirectMessage value) { + return ( + FfiConverterString.INSTANCE.allocationSize(value.recipientId()) + + FfiConverterSequenceByte.INSTANCE.allocationSize(value.data()) + ); + } + + @Override + public void write(WifiDirectMessage value, java.nio.ByteBuffer buf) { + FfiConverterString.INSTANCE.write(value.recipientId(), buf); + FfiConverterSequenceByte.INSTANCE.write(value.data(), buf); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeWifiDirectTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeWifiDirectTransportCallback.java new file mode 100644 index 00000000..3ce4e844 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FfiConverterTypeWifiDirectTransportCallback.java @@ -0,0 +1,9 @@ +package com.offlineprotocol.sdk; + + +// The ffiConverter which transforms the Callbacks in to handles to pass to Rust. +public final class FfiConverterTypeWifiDirectTransportCallback extends FfiConverterCallbackInterface { + static final FfiConverterTypeWifiDirectTransportCallback INSTANCE = new FfiConverterTypeWifiDirectTransportCallback(); + + private FfiConverterTypeWifiDirectTransportCallback() {} +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/FileProgress.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/FileProgress.java new file mode 100644 index 00000000..665f36c0 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/FileProgress.java @@ -0,0 +1,89 @@ +package com.offlineprotocol.sdk; + +public class FileProgress { + private java.lang.String fileId; + private int chunksSent; + private int totalChunks; + private byte percentage; + + public FileProgress( + java.lang.String fileId, + int chunksSent, + int totalChunks, + byte percentage + ) { + + this.fileId = fileId; + + this.chunksSent = chunksSent; + + this.totalChunks = totalChunks; + + this.percentage = percentage; + } + + public java.lang.String fileId() { + return this.fileId; + } + + public int chunksSent() { + return this.chunksSent; + } + + public int totalChunks() { + return this.totalChunks; + } + + public byte percentage() { + return this.percentage; + } + public void setFileId(java.lang.String fileId) { + this.fileId = fileId; + } + public void setChunksSent(int chunksSent) { + this.chunksSent = chunksSent; + } + public void setTotalChunks(int totalChunks) { + this.totalChunks = totalChunks; + } + public void setPercentage(byte percentage) { + this.percentage = percentage; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof FileProgress) { + FileProgress _uniffiThat = (FileProgress) _uniffiOther; + return ( + java.util.Objects.equals(fileId, _uniffiThat.fileId) && + + chunksSent == _uniffiThat.chunksSent && + + totalChunks == _uniffiThat.totalChunks && + + percentage == _uniffiThat.percentage + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(fileId); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(chunksSent); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(totalChunks); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(percentage); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ForeignBytes.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ForeignBytes.java new file mode 100644 index 00000000..3a69f8a6 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ForeignBytes.java @@ -0,0 +1,34 @@ +package com.offlineprotocol.sdk; + + +// Pointer + length for bytes owned by the JVM and borrowed by Rust for the duration of one call. +// Used for `&[u8]` / `[ByRef] bytes` arguments; see FfiConverterByRefBytes. +public final class ForeignBytes { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_INT.withName("len"), + java.lang.foreign.MemoryLayout.paddingLayout(4), // 4 bytes padding for alignment before ADDRESS + java.lang.foreign.ValueLayout.ADDRESS.withName("data") + ); + + private static final long OFFSET_LEN = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("len")); + private static final long OFFSET_DATA = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("data")); + + private ForeignBytes() {} + + public static int getLen(java.lang.foreign.MemorySegment seg) { + return seg.get(java.lang.foreign.ValueLayout.JAVA_INT_UNALIGNED, OFFSET_LEN); + } + + public static void setLen(java.lang.foreign.MemorySegment seg, int value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_INT_UNALIGNED, OFFSET_LEN, value); + } + + public static java.lang.foreign.MemorySegment getData(java.lang.foreign.MemorySegment seg) { + return seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_DATA); + } + + public static void setData(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_DATA, value); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ForwardInfo.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ForwardInfo.java new file mode 100644 index 00000000..df8023db --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ForwardInfo.java @@ -0,0 +1,89 @@ +package com.offlineprotocol.sdk; + +public class ForwardInfo { + private java.lang.String originalSender; + private java.lang.String originalMessageId; + private long originalTimestamp; + private int forwardCount; + + public ForwardInfo( + java.lang.String originalSender, + java.lang.String originalMessageId, + long originalTimestamp, + int forwardCount + ) { + + this.originalSender = originalSender; + + this.originalMessageId = originalMessageId; + + this.originalTimestamp = originalTimestamp; + + this.forwardCount = forwardCount; + } + + public java.lang.String originalSender() { + return this.originalSender; + } + + public java.lang.String originalMessageId() { + return this.originalMessageId; + } + + public long originalTimestamp() { + return this.originalTimestamp; + } + + public int forwardCount() { + return this.forwardCount; + } + public void setOriginalSender(java.lang.String originalSender) { + this.originalSender = originalSender; + } + public void setOriginalMessageId(java.lang.String originalMessageId) { + this.originalMessageId = originalMessageId; + } + public void setOriginalTimestamp(long originalTimestamp) { + this.originalTimestamp = originalTimestamp; + } + public void setForwardCount(int forwardCount) { + this.forwardCount = forwardCount; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof ForwardInfo) { + ForwardInfo _uniffiThat = (ForwardInfo) _uniffiOther; + return ( + java.util.Objects.equals(originalSender, _uniffiThat.originalSender) && + + java.util.Objects.equals(originalMessageId, _uniffiThat.originalMessageId) && + + originalTimestamp == _uniffiThat.originalTimestamp && + + forwardCount == _uniffiThat.forwardCount + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(originalSender); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(originalMessageId); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(originalTimestamp); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(forwardCount); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/GatewayAddressDeclaration.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/GatewayAddressDeclaration.java new file mode 100644 index 00000000..cf6da5b9 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/GatewayAddressDeclaration.java @@ -0,0 +1,75 @@ +package com.offlineprotocol.sdk; + +public class GatewayAddressDeclaration { + private java.lang.String address; + private java.util.List publicKey; + private java.util.List signature; + + public GatewayAddressDeclaration( + java.lang.String address, + java.util.List publicKey, + java.util.List signature + ) { + + this.address = address; + + this.publicKey = publicKey; + + this.signature = signature; + } + + public java.lang.String address() { + return this.address; + } + + public java.util.List publicKey() { + return this.publicKey; + } + + public java.util.List signature() { + return this.signature; + } + public void setAddress(java.lang.String address) { + this.address = address; + } + public void setPublicKey(java.util.List publicKey) { + this.publicKey = publicKey; + } + public void setSignature(java.util.List signature) { + this.signature = signature; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof GatewayAddressDeclaration) { + GatewayAddressDeclaration _uniffiThat = (GatewayAddressDeclaration) _uniffiOther; + return ( + java.util.Objects.equals(address, _uniffiThat.address) && + + java.util.Objects.equals(publicKey, _uniffiThat.publicKey) && + + java.util.Objects.equals(signature, _uniffiThat.signature) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(address); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(publicKey); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(signature); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/GroupRichReadiness.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/GroupRichReadiness.java new file mode 100644 index 00000000..d33a8f84 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/GroupRichReadiness.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + +public class GroupRichReadiness { + private boolean ready; + private java.util.List unknownMembers; + + public GroupRichReadiness( + boolean ready, + java.util.List unknownMembers + ) { + + this.ready = ready; + + this.unknownMembers = unknownMembers; + } + + public boolean ready() { + return this.ready; + } + + public java.util.List unknownMembers() { + return this.unknownMembers; + } + public void setReady(boolean ready) { + this.ready = ready; + } + public void setUnknownMembers(java.util.List unknownMembers) { + this.unknownMembers = unknownMembers; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof GroupRichReadiness) { + GroupRichReadiness _uniffiThat = (GroupRichReadiness) _uniffiOther; + return ( + ready == _uniffiThat.ready && + + java.util.Objects.equals(unknownMembers, _uniffiThat.unknownMembers) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(ready); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(unknownMembers); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/InternalException.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/InternalException.java new file mode 100644 index 00000000..04de293e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/InternalException.java @@ -0,0 +1,9 @@ +package com.offlineprotocol.sdk; + + +public class InternalException extends java.lang.RuntimeException { + public InternalException(java.lang.String message) { + super(message); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/InternetMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/InternetMessage.java new file mode 100644 index 00000000..19e92618 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/InternetMessage.java @@ -0,0 +1,117 @@ +package com.offlineprotocol.sdk; + +public class InternetMessage { + private java.lang.String messageId; + private java.lang.String recipientId; + private java.util.List data; + private java.lang.String replyToMsg; + private java.lang.String controlOp; + private java.lang.String controlPayload; + + public InternetMessage( + java.lang.String messageId, + java.lang.String recipientId, + java.util.List data, + java.lang.String replyToMsg, + java.lang.String controlOp, + java.lang.String controlPayload + ) { + + this.messageId = messageId; + + this.recipientId = recipientId; + + this.data = data; + + this.replyToMsg = replyToMsg; + + this.controlOp = controlOp; + + this.controlPayload = controlPayload; + } + + public java.lang.String messageId() { + return this.messageId; + } + + public java.lang.String recipientId() { + return this.recipientId; + } + + public java.util.List data() { + return this.data; + } + + public java.lang.String replyToMsg() { + return this.replyToMsg; + } + + public java.lang.String controlOp() { + return this.controlOp; + } + + public java.lang.String controlPayload() { + return this.controlPayload; + } + public void setMessageId(java.lang.String messageId) { + this.messageId = messageId; + } + public void setRecipientId(java.lang.String recipientId) { + this.recipientId = recipientId; + } + public void setData(java.util.List data) { + this.data = data; + } + public void setReplyToMsg(java.lang.String replyToMsg) { + this.replyToMsg = replyToMsg; + } + public void setControlOp(java.lang.String controlOp) { + this.controlOp = controlOp; + } + public void setControlPayload(java.lang.String controlPayload) { + this.controlPayload = controlPayload; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof InternetMessage) { + InternetMessage _uniffiThat = (InternetMessage) _uniffiOther; + return ( + java.util.Objects.equals(messageId, _uniffiThat.messageId) && + + java.util.Objects.equals(recipientId, _uniffiThat.recipientId) && + + java.util.Objects.equals(data, _uniffiThat.data) && + + java.util.Objects.equals(replyToMsg, _uniffiThat.replyToMsg) && + + java.util.Objects.equals(controlOp, _uniffiThat.controlOp) && + + java.util.Objects.equals(controlPayload, _uniffiThat.controlPayload) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(messageId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(recipientId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(data); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(replyToMsg); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(controlOp); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(controlPayload); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/InviteInfo.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/InviteInfo.java new file mode 100644 index 00000000..aa7a2662 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/InviteInfo.java @@ -0,0 +1,89 @@ +package com.offlineprotocol.sdk; + +public class InviteInfo { + private java.lang.String address; + private java.util.List publicKey; + private java.lang.String petname; + private boolean signed; + + public InviteInfo( + java.lang.String address, + java.util.List publicKey, + java.lang.String petname, + boolean signed + ) { + + this.address = address; + + this.publicKey = publicKey; + + this.petname = petname; + + this.signed = signed; + } + + public java.lang.String address() { + return this.address; + } + + public java.util.List publicKey() { + return this.publicKey; + } + + public java.lang.String petname() { + return this.petname; + } + + public boolean signed() { + return this.signed; + } + public void setAddress(java.lang.String address) { + this.address = address; + } + public void setPublicKey(java.util.List publicKey) { + this.publicKey = publicKey; + } + public void setPetname(java.lang.String petname) { + this.petname = petname; + } + public void setSigned(boolean signed) { + this.signed = signed; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof InviteInfo) { + InviteInfo _uniffiThat = (InviteInfo) _uniffiOther; + return ( + java.util.Objects.equals(address, _uniffiThat.address) && + + java.util.Objects.equals(publicKey, _uniffiThat.publicKey) && + + java.util.Objects.equals(petname, _uniffiThat.petname) && + + signed == _uniffiThat.signed + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(address); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(publicKey); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(petname); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(signed); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MediaMetadata.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MediaMetadata.java new file mode 100644 index 00000000..849d906f --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MediaMetadata.java @@ -0,0 +1,257 @@ +package com.offlineprotocol.sdk; + +public class MediaMetadata { + private java.lang.String mimeType; + private java.lang.String fileName; + private long fileSize; + private java.lang.Long durationMs; + private java.lang.Integer width; + private java.lang.Integer height; + private java.lang.String thumbnailBase64; + private java.lang.String mediaId; + private java.lang.String downloadUrl; + private java.lang.String thumbnailUrl; + private java.lang.String encryptionKey; + private java.lang.String iv; + private java.lang.String ciphertextHash; + private java.lang.String stickerProvider; + private java.lang.String stickerRemoteId; + private java.lang.String stickerKind; + + public MediaMetadata( + java.lang.String mimeType, + java.lang.String fileName, + long fileSize, + java.lang.Long durationMs, + java.lang.Integer width, + java.lang.Integer height, + java.lang.String thumbnailBase64, + java.lang.String mediaId, + java.lang.String downloadUrl, + java.lang.String thumbnailUrl, + java.lang.String encryptionKey, + java.lang.String iv, + java.lang.String ciphertextHash, + java.lang.String stickerProvider, + java.lang.String stickerRemoteId, + java.lang.String stickerKind + ) { + + this.mimeType = mimeType; + + this.fileName = fileName; + + this.fileSize = fileSize; + + this.durationMs = durationMs; + + this.width = width; + + this.height = height; + + this.thumbnailBase64 = thumbnailBase64; + + this.mediaId = mediaId; + + this.downloadUrl = downloadUrl; + + this.thumbnailUrl = thumbnailUrl; + + this.encryptionKey = encryptionKey; + + this.iv = iv; + + this.ciphertextHash = ciphertextHash; + + this.stickerProvider = stickerProvider; + + this.stickerRemoteId = stickerRemoteId; + + this.stickerKind = stickerKind; + } + + public java.lang.String mimeType() { + return this.mimeType; + } + + public java.lang.String fileName() { + return this.fileName; + } + + public long fileSize() { + return this.fileSize; + } + + public java.lang.Long durationMs() { + return this.durationMs; + } + + public java.lang.Integer width() { + return this.width; + } + + public java.lang.Integer height() { + return this.height; + } + + public java.lang.String thumbnailBase64() { + return this.thumbnailBase64; + } + + public java.lang.String mediaId() { + return this.mediaId; + } + + public java.lang.String downloadUrl() { + return this.downloadUrl; + } + + public java.lang.String thumbnailUrl() { + return this.thumbnailUrl; + } + + public java.lang.String encryptionKey() { + return this.encryptionKey; + } + + public java.lang.String iv() { + return this.iv; + } + + public java.lang.String ciphertextHash() { + return this.ciphertextHash; + } + + public java.lang.String stickerProvider() { + return this.stickerProvider; + } + + public java.lang.String stickerRemoteId() { + return this.stickerRemoteId; + } + + public java.lang.String stickerKind() { + return this.stickerKind; + } + public void setMimeType(java.lang.String mimeType) { + this.mimeType = mimeType; + } + public void setFileName(java.lang.String fileName) { + this.fileName = fileName; + } + public void setFileSize(long fileSize) { + this.fileSize = fileSize; + } + public void setDurationMs(java.lang.Long durationMs) { + this.durationMs = durationMs; + } + public void setWidth(java.lang.Integer width) { + this.width = width; + } + public void setHeight(java.lang.Integer height) { + this.height = height; + } + public void setThumbnailBase64(java.lang.String thumbnailBase64) { + this.thumbnailBase64 = thumbnailBase64; + } + public void setMediaId(java.lang.String mediaId) { + this.mediaId = mediaId; + } + public void setDownloadUrl(java.lang.String downloadUrl) { + this.downloadUrl = downloadUrl; + } + public void setThumbnailUrl(java.lang.String thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + } + public void setEncryptionKey(java.lang.String encryptionKey) { + this.encryptionKey = encryptionKey; + } + public void setIv(java.lang.String iv) { + this.iv = iv; + } + public void setCiphertextHash(java.lang.String ciphertextHash) { + this.ciphertextHash = ciphertextHash; + } + public void setStickerProvider(java.lang.String stickerProvider) { + this.stickerProvider = stickerProvider; + } + public void setStickerRemoteId(java.lang.String stickerRemoteId) { + this.stickerRemoteId = stickerRemoteId; + } + public void setStickerKind(java.lang.String stickerKind) { + this.stickerKind = stickerKind; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MediaMetadata) { + MediaMetadata _uniffiThat = (MediaMetadata) _uniffiOther; + return ( + java.util.Objects.equals(mimeType, _uniffiThat.mimeType) && + + java.util.Objects.equals(fileName, _uniffiThat.fileName) && + + fileSize == _uniffiThat.fileSize && + + java.util.Objects.equals(durationMs, _uniffiThat.durationMs) && + + java.util.Objects.equals(width, _uniffiThat.width) && + + java.util.Objects.equals(height, _uniffiThat.height) && + + java.util.Objects.equals(thumbnailBase64, _uniffiThat.thumbnailBase64) && + + java.util.Objects.equals(mediaId, _uniffiThat.mediaId) && + + java.util.Objects.equals(downloadUrl, _uniffiThat.downloadUrl) && + + java.util.Objects.equals(thumbnailUrl, _uniffiThat.thumbnailUrl) && + + java.util.Objects.equals(encryptionKey, _uniffiThat.encryptionKey) && + + java.util.Objects.equals(iv, _uniffiThat.iv) && + + java.util.Objects.equals(ciphertextHash, _uniffiThat.ciphertextHash) && + + java.util.Objects.equals(stickerProvider, _uniffiThat.stickerProvider) && + + java.util.Objects.equals(stickerRemoteId, _uniffiThat.stickerRemoteId) && + + java.util.Objects.equals(stickerKind, _uniffiThat.stickerKind) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(mimeType); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(fileName); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(fileSize); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(durationMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(width); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(height); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(thumbnailBase64); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(mediaId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(downloadUrl); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(thumbnailUrl); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(encryptionKey); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(iv); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(ciphertextHash); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(stickerProvider); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(stickerRemoteId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(stickerKind); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MediaSendOptions.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MediaSendOptions.java new file mode 100644 index 00000000..d5bc3277 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MediaSendOptions.java @@ -0,0 +1,131 @@ +package com.offlineprotocol.sdk; + +public class MediaSendOptions { + private MediaMetadata mediaMetadata; + private java.lang.String caption; + private java.lang.String replyToMsg; + private ReplyContext replyContext; + private ForwardInfo forwardInfo; + private java.lang.String fileId; + private java.lang.String appId; + + public MediaSendOptions( + MediaMetadata mediaMetadata, + java.lang.String caption, + java.lang.String replyToMsg, + ReplyContext replyContext, + ForwardInfo forwardInfo, + java.lang.String fileId, + java.lang.String appId + ) { + + this.mediaMetadata = mediaMetadata; + + this.caption = caption; + + this.replyToMsg = replyToMsg; + + this.replyContext = replyContext; + + this.forwardInfo = forwardInfo; + + this.fileId = fileId; + + this.appId = appId; + } + + public MediaMetadata mediaMetadata() { + return this.mediaMetadata; + } + + public java.lang.String caption() { + return this.caption; + } + + public java.lang.String replyToMsg() { + return this.replyToMsg; + } + + public ReplyContext replyContext() { + return this.replyContext; + } + + public ForwardInfo forwardInfo() { + return this.forwardInfo; + } + + public java.lang.String fileId() { + return this.fileId; + } + + public java.lang.String appId() { + return this.appId; + } + public void setMediaMetadata(MediaMetadata mediaMetadata) { + this.mediaMetadata = mediaMetadata; + } + public void setCaption(java.lang.String caption) { + this.caption = caption; + } + public void setReplyToMsg(java.lang.String replyToMsg) { + this.replyToMsg = replyToMsg; + } + public void setReplyContext(ReplyContext replyContext) { + this.replyContext = replyContext; + } + public void setForwardInfo(ForwardInfo forwardInfo) { + this.forwardInfo = forwardInfo; + } + public void setFileId(java.lang.String fileId) { + this.fileId = fileId; + } + public void setAppId(java.lang.String appId) { + this.appId = appId; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MediaSendOptions) { + MediaSendOptions _uniffiThat = (MediaSendOptions) _uniffiOther; + return ( + java.util.Objects.equals(mediaMetadata, _uniffiThat.mediaMetadata) && + + java.util.Objects.equals(caption, _uniffiThat.caption) && + + java.util.Objects.equals(replyToMsg, _uniffiThat.replyToMsg) && + + java.util.Objects.equals(replyContext, _uniffiThat.replyContext) && + + java.util.Objects.equals(forwardInfo, _uniffiThat.forwardInfo) && + + java.util.Objects.equals(fileId, _uniffiThat.fileId) && + + java.util.Objects.equals(appId, _uniffiThat.appId) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(mediaMetadata); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(caption); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(replyToMsg); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(replyContext); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(forwardInfo); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(fileId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(appId); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayConfig.java new file mode 100644 index 00000000..1f5381f4 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayConfig.java @@ -0,0 +1,257 @@ +package com.offlineprotocol.sdk; + +public class MeshRelayConfig { + private java.lang.Byte maxTtl; + private java.lang.Byte denseMaxTtl; + private java.lang.Long denseDegree; + private java.lang.Long fanout; + private java.lang.Long jitterMinMs; + private java.lang.Long jitterMaxMs; + private java.lang.Float ratePerSec; + private java.lang.Float burst; + private java.lang.Float peerRatePerSec; + private java.lang.Float peerBurst; + private java.lang.Long queueCapacity; + private java.lang.Float biasMinScale; + private java.lang.Long biasMaxHandicapMs; + private java.lang.Long activityWindowMs; + private java.lang.Long activityMinForwards; + private java.lang.Integer activityIdleWindows; + + public MeshRelayConfig( + java.lang.Byte maxTtl, + java.lang.Byte denseMaxTtl, + java.lang.Long denseDegree, + java.lang.Long fanout, + java.lang.Long jitterMinMs, + java.lang.Long jitterMaxMs, + java.lang.Float ratePerSec, + java.lang.Float burst, + java.lang.Float peerRatePerSec, + java.lang.Float peerBurst, + java.lang.Long queueCapacity, + java.lang.Float biasMinScale, + java.lang.Long biasMaxHandicapMs, + java.lang.Long activityWindowMs, + java.lang.Long activityMinForwards, + java.lang.Integer activityIdleWindows + ) { + + this.maxTtl = maxTtl; + + this.denseMaxTtl = denseMaxTtl; + + this.denseDegree = denseDegree; + + this.fanout = fanout; + + this.jitterMinMs = jitterMinMs; + + this.jitterMaxMs = jitterMaxMs; + + this.ratePerSec = ratePerSec; + + this.burst = burst; + + this.peerRatePerSec = peerRatePerSec; + + this.peerBurst = peerBurst; + + this.queueCapacity = queueCapacity; + + this.biasMinScale = biasMinScale; + + this.biasMaxHandicapMs = biasMaxHandicapMs; + + this.activityWindowMs = activityWindowMs; + + this.activityMinForwards = activityMinForwards; + + this.activityIdleWindows = activityIdleWindows; + } + + public java.lang.Byte maxTtl() { + return this.maxTtl; + } + + public java.lang.Byte denseMaxTtl() { + return this.denseMaxTtl; + } + + public java.lang.Long denseDegree() { + return this.denseDegree; + } + + public java.lang.Long fanout() { + return this.fanout; + } + + public java.lang.Long jitterMinMs() { + return this.jitterMinMs; + } + + public java.lang.Long jitterMaxMs() { + return this.jitterMaxMs; + } + + public java.lang.Float ratePerSec() { + return this.ratePerSec; + } + + public java.lang.Float burst() { + return this.burst; + } + + public java.lang.Float peerRatePerSec() { + return this.peerRatePerSec; + } + + public java.lang.Float peerBurst() { + return this.peerBurst; + } + + public java.lang.Long queueCapacity() { + return this.queueCapacity; + } + + public java.lang.Float biasMinScale() { + return this.biasMinScale; + } + + public java.lang.Long biasMaxHandicapMs() { + return this.biasMaxHandicapMs; + } + + public java.lang.Long activityWindowMs() { + return this.activityWindowMs; + } + + public java.lang.Long activityMinForwards() { + return this.activityMinForwards; + } + + public java.lang.Integer activityIdleWindows() { + return this.activityIdleWindows; + } + public void setMaxTtl(java.lang.Byte maxTtl) { + this.maxTtl = maxTtl; + } + public void setDenseMaxTtl(java.lang.Byte denseMaxTtl) { + this.denseMaxTtl = denseMaxTtl; + } + public void setDenseDegree(java.lang.Long denseDegree) { + this.denseDegree = denseDegree; + } + public void setFanout(java.lang.Long fanout) { + this.fanout = fanout; + } + public void setJitterMinMs(java.lang.Long jitterMinMs) { + this.jitterMinMs = jitterMinMs; + } + public void setJitterMaxMs(java.lang.Long jitterMaxMs) { + this.jitterMaxMs = jitterMaxMs; + } + public void setRatePerSec(java.lang.Float ratePerSec) { + this.ratePerSec = ratePerSec; + } + public void setBurst(java.lang.Float burst) { + this.burst = burst; + } + public void setPeerRatePerSec(java.lang.Float peerRatePerSec) { + this.peerRatePerSec = peerRatePerSec; + } + public void setPeerBurst(java.lang.Float peerBurst) { + this.peerBurst = peerBurst; + } + public void setQueueCapacity(java.lang.Long queueCapacity) { + this.queueCapacity = queueCapacity; + } + public void setBiasMinScale(java.lang.Float biasMinScale) { + this.biasMinScale = biasMinScale; + } + public void setBiasMaxHandicapMs(java.lang.Long biasMaxHandicapMs) { + this.biasMaxHandicapMs = biasMaxHandicapMs; + } + public void setActivityWindowMs(java.lang.Long activityWindowMs) { + this.activityWindowMs = activityWindowMs; + } + public void setActivityMinForwards(java.lang.Long activityMinForwards) { + this.activityMinForwards = activityMinForwards; + } + public void setActivityIdleWindows(java.lang.Integer activityIdleWindows) { + this.activityIdleWindows = activityIdleWindows; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MeshRelayConfig) { + MeshRelayConfig _uniffiThat = (MeshRelayConfig) _uniffiOther; + return ( + java.util.Objects.equals(maxTtl, _uniffiThat.maxTtl) && + + java.util.Objects.equals(denseMaxTtl, _uniffiThat.denseMaxTtl) && + + java.util.Objects.equals(denseDegree, _uniffiThat.denseDegree) && + + java.util.Objects.equals(fanout, _uniffiThat.fanout) && + + java.util.Objects.equals(jitterMinMs, _uniffiThat.jitterMinMs) && + + java.util.Objects.equals(jitterMaxMs, _uniffiThat.jitterMaxMs) && + + java.util.Objects.equals(ratePerSec, _uniffiThat.ratePerSec) && + + java.util.Objects.equals(burst, _uniffiThat.burst) && + + java.util.Objects.equals(peerRatePerSec, _uniffiThat.peerRatePerSec) && + + java.util.Objects.equals(peerBurst, _uniffiThat.peerBurst) && + + java.util.Objects.equals(queueCapacity, _uniffiThat.queueCapacity) && + + java.util.Objects.equals(biasMinScale, _uniffiThat.biasMinScale) && + + java.util.Objects.equals(biasMaxHandicapMs, _uniffiThat.biasMaxHandicapMs) && + + java.util.Objects.equals(activityWindowMs, _uniffiThat.activityWindowMs) && + + java.util.Objects.equals(activityMinForwards, _uniffiThat.activityMinForwards) && + + java.util.Objects.equals(activityIdleWindows, _uniffiThat.activityIdleWindows) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(maxTtl); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(denseMaxTtl); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(denseDegree); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(fanout); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(jitterMinMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(jitterMaxMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(ratePerSec); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(burst); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(peerRatePerSec); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(peerBurst); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(queueCapacity); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(biasMinScale); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(biasMaxHandicapMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(activityWindowMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(activityMinForwards); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(activityIdleWindows); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayStats.java new file mode 100644 index 00000000..b0582ce2 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayStats.java @@ -0,0 +1,215 @@ +package com.offlineprotocol.sdk; + +public class MeshRelayStats { + private long forwarded; + private long transmissions; + private long queued; + private long awaitingTransmission; + private long duplicatesSuppressed; + private long coveredByANeighbor; + private long peerRateLimited; + private long refusedQueueFull; + private long rateDeferred; + private long abandonedOverdue; + private long hopLimitReached; + private long reachClamped; + private long droppedForCapacity; + + public MeshRelayStats( + long forwarded, + long transmissions, + long queued, + long awaitingTransmission, + long duplicatesSuppressed, + long coveredByANeighbor, + long peerRateLimited, + long refusedQueueFull, + long rateDeferred, + long abandonedOverdue, + long hopLimitReached, + long reachClamped, + long droppedForCapacity + ) { + + this.forwarded = forwarded; + + this.transmissions = transmissions; + + this.queued = queued; + + this.awaitingTransmission = awaitingTransmission; + + this.duplicatesSuppressed = duplicatesSuppressed; + + this.coveredByANeighbor = coveredByANeighbor; + + this.peerRateLimited = peerRateLimited; + + this.refusedQueueFull = refusedQueueFull; + + this.rateDeferred = rateDeferred; + + this.abandonedOverdue = abandonedOverdue; + + this.hopLimitReached = hopLimitReached; + + this.reachClamped = reachClamped; + + this.droppedForCapacity = droppedForCapacity; + } + + public long forwarded() { + return this.forwarded; + } + + public long transmissions() { + return this.transmissions; + } + + public long queued() { + return this.queued; + } + + public long awaitingTransmission() { + return this.awaitingTransmission; + } + + public long duplicatesSuppressed() { + return this.duplicatesSuppressed; + } + + public long coveredByANeighbor() { + return this.coveredByANeighbor; + } + + public long peerRateLimited() { + return this.peerRateLimited; + } + + public long refusedQueueFull() { + return this.refusedQueueFull; + } + + public long rateDeferred() { + return this.rateDeferred; + } + + public long abandonedOverdue() { + return this.abandonedOverdue; + } + + public long hopLimitReached() { + return this.hopLimitReached; + } + + public long reachClamped() { + return this.reachClamped; + } + + public long droppedForCapacity() { + return this.droppedForCapacity; + } + public void setForwarded(long forwarded) { + this.forwarded = forwarded; + } + public void setTransmissions(long transmissions) { + this.transmissions = transmissions; + } + public void setQueued(long queued) { + this.queued = queued; + } + public void setAwaitingTransmission(long awaitingTransmission) { + this.awaitingTransmission = awaitingTransmission; + } + public void setDuplicatesSuppressed(long duplicatesSuppressed) { + this.duplicatesSuppressed = duplicatesSuppressed; + } + public void setCoveredByANeighbor(long coveredByANeighbor) { + this.coveredByANeighbor = coveredByANeighbor; + } + public void setPeerRateLimited(long peerRateLimited) { + this.peerRateLimited = peerRateLimited; + } + public void setRefusedQueueFull(long refusedQueueFull) { + this.refusedQueueFull = refusedQueueFull; + } + public void setRateDeferred(long rateDeferred) { + this.rateDeferred = rateDeferred; + } + public void setAbandonedOverdue(long abandonedOverdue) { + this.abandonedOverdue = abandonedOverdue; + } + public void setHopLimitReached(long hopLimitReached) { + this.hopLimitReached = hopLimitReached; + } + public void setReachClamped(long reachClamped) { + this.reachClamped = reachClamped; + } + public void setDroppedForCapacity(long droppedForCapacity) { + this.droppedForCapacity = droppedForCapacity; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MeshRelayStats) { + MeshRelayStats _uniffiThat = (MeshRelayStats) _uniffiOther; + return ( + forwarded == _uniffiThat.forwarded && + + transmissions == _uniffiThat.transmissions && + + queued == _uniffiThat.queued && + + awaitingTransmission == _uniffiThat.awaitingTransmission && + + duplicatesSuppressed == _uniffiThat.duplicatesSuppressed && + + coveredByANeighbor == _uniffiThat.coveredByANeighbor && + + peerRateLimited == _uniffiThat.peerRateLimited && + + refusedQueueFull == _uniffiThat.refusedQueueFull && + + rateDeferred == _uniffiThat.rateDeferred && + + abandonedOverdue == _uniffiThat.abandonedOverdue && + + hopLimitReached == _uniffiThat.hopLimitReached && + + reachClamped == _uniffiThat.reachClamped && + + droppedForCapacity == _uniffiThat.droppedForCapacity + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(forwarded); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(transmissions); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(queued); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(awaitingTransmission); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(duplicatesSuppressed); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(coveredByANeighbor); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(peerRateLimited); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(refusedQueueFull); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(rateDeferred); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(abandonedOverdue); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(hopLimitReached); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(reachClamped); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(droppedForCapacity); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayTunables.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayTunables.java new file mode 100644 index 00000000..7695ba74 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshRelayTunables.java @@ -0,0 +1,257 @@ +package com.offlineprotocol.sdk; + +public class MeshRelayTunables { + private byte maxTtl; + private byte denseMaxTtl; + private long denseDegree; + private long fanout; + private long jitterMinMs; + private long jitterMaxMs; + private float ratePerSec; + private float burst; + private float peerRatePerSec; + private float peerBurst; + private long queueCapacity; + private float biasMinScale; + private long biasMaxHandicapMs; + private long activityWindowMs; + private long activityMinForwards; + private int activityIdleWindows; + + public MeshRelayTunables( + byte maxTtl, + byte denseMaxTtl, + long denseDegree, + long fanout, + long jitterMinMs, + long jitterMaxMs, + float ratePerSec, + float burst, + float peerRatePerSec, + float peerBurst, + long queueCapacity, + float biasMinScale, + long biasMaxHandicapMs, + long activityWindowMs, + long activityMinForwards, + int activityIdleWindows + ) { + + this.maxTtl = maxTtl; + + this.denseMaxTtl = denseMaxTtl; + + this.denseDegree = denseDegree; + + this.fanout = fanout; + + this.jitterMinMs = jitterMinMs; + + this.jitterMaxMs = jitterMaxMs; + + this.ratePerSec = ratePerSec; + + this.burst = burst; + + this.peerRatePerSec = peerRatePerSec; + + this.peerBurst = peerBurst; + + this.queueCapacity = queueCapacity; + + this.biasMinScale = biasMinScale; + + this.biasMaxHandicapMs = biasMaxHandicapMs; + + this.activityWindowMs = activityWindowMs; + + this.activityMinForwards = activityMinForwards; + + this.activityIdleWindows = activityIdleWindows; + } + + public byte maxTtl() { + return this.maxTtl; + } + + public byte denseMaxTtl() { + return this.denseMaxTtl; + } + + public long denseDegree() { + return this.denseDegree; + } + + public long fanout() { + return this.fanout; + } + + public long jitterMinMs() { + return this.jitterMinMs; + } + + public long jitterMaxMs() { + return this.jitterMaxMs; + } + + public float ratePerSec() { + return this.ratePerSec; + } + + public float burst() { + return this.burst; + } + + public float peerRatePerSec() { + return this.peerRatePerSec; + } + + public float peerBurst() { + return this.peerBurst; + } + + public long queueCapacity() { + return this.queueCapacity; + } + + public float biasMinScale() { + return this.biasMinScale; + } + + public long biasMaxHandicapMs() { + return this.biasMaxHandicapMs; + } + + public long activityWindowMs() { + return this.activityWindowMs; + } + + public long activityMinForwards() { + return this.activityMinForwards; + } + + public int activityIdleWindows() { + return this.activityIdleWindows; + } + public void setMaxTtl(byte maxTtl) { + this.maxTtl = maxTtl; + } + public void setDenseMaxTtl(byte denseMaxTtl) { + this.denseMaxTtl = denseMaxTtl; + } + public void setDenseDegree(long denseDegree) { + this.denseDegree = denseDegree; + } + public void setFanout(long fanout) { + this.fanout = fanout; + } + public void setJitterMinMs(long jitterMinMs) { + this.jitterMinMs = jitterMinMs; + } + public void setJitterMaxMs(long jitterMaxMs) { + this.jitterMaxMs = jitterMaxMs; + } + public void setRatePerSec(float ratePerSec) { + this.ratePerSec = ratePerSec; + } + public void setBurst(float burst) { + this.burst = burst; + } + public void setPeerRatePerSec(float peerRatePerSec) { + this.peerRatePerSec = peerRatePerSec; + } + public void setPeerBurst(float peerBurst) { + this.peerBurst = peerBurst; + } + public void setQueueCapacity(long queueCapacity) { + this.queueCapacity = queueCapacity; + } + public void setBiasMinScale(float biasMinScale) { + this.biasMinScale = biasMinScale; + } + public void setBiasMaxHandicapMs(long biasMaxHandicapMs) { + this.biasMaxHandicapMs = biasMaxHandicapMs; + } + public void setActivityWindowMs(long activityWindowMs) { + this.activityWindowMs = activityWindowMs; + } + public void setActivityMinForwards(long activityMinForwards) { + this.activityMinForwards = activityMinForwards; + } + public void setActivityIdleWindows(int activityIdleWindows) { + this.activityIdleWindows = activityIdleWindows; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MeshRelayTunables) { + MeshRelayTunables _uniffiThat = (MeshRelayTunables) _uniffiOther; + return ( + maxTtl == _uniffiThat.maxTtl && + + denseMaxTtl == _uniffiThat.denseMaxTtl && + + denseDegree == _uniffiThat.denseDegree && + + fanout == _uniffiThat.fanout && + + jitterMinMs == _uniffiThat.jitterMinMs && + + jitterMaxMs == _uniffiThat.jitterMaxMs && + + java.lang.Float.compare(ratePerSec, _uniffiThat.ratePerSec) == 0 && + + java.lang.Float.compare(burst, _uniffiThat.burst) == 0 && + + java.lang.Float.compare(peerRatePerSec, _uniffiThat.peerRatePerSec) == 0 && + + java.lang.Float.compare(peerBurst, _uniffiThat.peerBurst) == 0 && + + queueCapacity == _uniffiThat.queueCapacity && + + java.lang.Float.compare(biasMinScale, _uniffiThat.biasMinScale) == 0 && + + biasMaxHandicapMs == _uniffiThat.biasMaxHandicapMs && + + activityWindowMs == _uniffiThat.activityWindowMs && + + activityMinForwards == _uniffiThat.activityMinForwards && + + activityIdleWindows == _uniffiThat.activityIdleWindows + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(maxTtl); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(denseMaxTtl); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(denseDegree); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(fanout); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(jitterMinMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(jitterMaxMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(ratePerSec); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(burst); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(peerRatePerSec); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(peerBurst); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(queueCapacity); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(biasMinScale); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(biasMaxHandicapMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(activityWindowMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(activityMinForwards); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(activityIdleWindows); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshServices.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshServices.java new file mode 100644 index 00000000..64f59e82 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshServices.java @@ -0,0 +1,290 @@ +package com.offlineprotocol.sdk; + +public class MeshServices implements AutoCloseable, MeshServicesInterface { + protected long handle; + protected UniffiCleaner.Cleanable cleanable; + + private java.util.concurrent.atomic.AtomicBoolean wasDestroyed = new java.util.concurrent.atomic.AtomicBoolean(false); + private java.util.concurrent.atomic.AtomicLong callCounter = new java.util.concurrent.atomic.AtomicLong(1); + + /** + * Internal constructor to wrap a raw handle from FFI. + * The UniffiWithHandle marker disambiguates this from other constructors. + */ + public MeshServices(UniffiWithHandle phantom, long handle) { + this.handle = handle; + this.cleanable = UniffiLib.CLEANER.register(this, new UniffiCleanAction(handle)); + } + + /** + * This constructor can be used to instantiate a fake object. Only used for tests. Any + * attempt to actually use an object constructed this way will fail as there is no + * connected Rust object. + */ + public MeshServices(NoHandle noHandle) { + this.handle = 0L; + this.cleanable = null; + } + + + public MeshServices(OfflineProtocol protocol) throws ProtocolException{ + this(UniffiWithHandle.INSTANCE, (long) + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_constructor_meshservices_new( + FfiConverterTypeOfflineProtocol.INSTANCE.lower(protocol), _status); + }) + ); + } + + @Override + public synchronized void close() { + // Only allow a single call to this method. + // TODO(uniffi): maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + if (cleanable != null) { + cleanable.clean(); + } + } + } + } + + public R callWithHandle(java.util.function.Function block) { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + long c; + do { + c = this.callCounter.get(); + if (c == 0L) { + throw new java.lang.IllegalStateException("MeshServices object has already been destroyed"); + } + if (c == java.lang.Long.MAX_VALUE) { + throw new java.lang.IllegalStateException("MeshServices call counter would overflow"); + } + } while (! this.callCounter.compareAndSet(c, c + 1L)); + // Now we can safely do the method call without the handle being freed concurrently. + try { + return block.apply(this.uniffiCloneHandle()); + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + if (cleanable != null) { + cleanable.clean(); + } + } + } + } + + public void callWithHandle(java.util.function.Consumer block) { + callWithHandle((java.lang.Long uniffiHandle) -> { + block.accept(uniffiHandle); + return (java.lang.Void)null; + }); + } + + private class UniffiCleanAction implements Runnable { + private final long handle; + + public UniffiCleanAction(long handle) { + this.handle = handle; + } + + @Override + public void run() { + // If the handle is 0 this is a fake object created with `NoHandle`, don't try to free. + if (handle != 0L) { + UniffiHelpers.uniffiRustCall((_allocator, status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_free_meshservices(handle, status); + return null; + }); + } + } + } + + long uniffiCloneHandle() { + return UniffiHelpers.uniffiRustCall((_allocator, status) -> { + if (handle == 0L) { + throw new java.lang.NullPointerException(); + } + return UniffiLib.uniffi_offline_protocol_uniffi_fn_clone_meshservices(handle, status); + }); + } + + + @Override + public java.lang.String discoverServices(java.lang.String serviceId) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_meshservices_discover_services(_allocator, _uniffiHandle, + FfiConverterOptionalString.INSTANCE.lower(serviceId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void registerService(java.lang.String serviceId, java.lang.String version, java.util.Map capabilities) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_meshservices_register_service(_uniffiHandle, + FfiConverterString.INSTANCE.lower(serviceId), FfiConverterString.INSTANCE.lower(version), FfiConverterMapStringString.INSTANCE.lower(capabilities), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String respondToServiceRequest(java.lang.String requestId, java.lang.String requester, java.lang.String serviceId, java.lang.String status, java.lang.String body) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_meshservices_respond_to_service_request(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(requestId), FfiConverterString.INSTANCE.lower(requester), FfiConverterString.INSTANCE.lower(serviceId), FfiConverterString.INSTANCE.lower(status), FfiConverterString.INSTANCE.lower(body), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendServiceRequest(java.lang.String provider, java.lang.String serviceId, java.lang.String method, java.lang.String body) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_meshservices_send_service_request(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(provider), FfiConverterString.INSTANCE.lower(serviceId), FfiConverterString.INSTANCE.lower(method), FfiConverterString.INSTANCE.lower(body), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean unregisterService(java.lang.String serviceId) throws ProtocolException { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_meshservices_unregister_service(_uniffiHandle, + FfiConverterString.INSTANCE.lower(serviceId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + + + + + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshServicesInterface.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshServicesInterface.java new file mode 100644 index 00000000..7243f4a1 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MeshServicesInterface.java @@ -0,0 +1,11 @@ +package com.offlineprotocol.sdk; + +public interface MeshServicesInterface { + public java.lang.String discoverServices(java.lang.String serviceId) throws ProtocolException; + public void registerService(java.lang.String serviceId, java.lang.String version, java.util.Map capabilities) throws ProtocolException; + public java.lang.String respondToServiceRequest(java.lang.String requestId, java.lang.String requester, java.lang.String serviceId, java.lang.String status, java.lang.String body) throws ProtocolException; + public java.lang.String sendServiceRequest(java.lang.String provider, java.lang.String serviceId, java.lang.String method, java.lang.String body) throws ProtocolException; + public boolean unregisterService(java.lang.String serviceId) throws ProtocolException; + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MessagePriority.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MessagePriority.java new file mode 100644 index 00000000..946aa640 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MessagePriority.java @@ -0,0 +1,17 @@ +package com.offlineprotocol.sdk; + + + +public enum MessagePriority { + LOW, + MEDIUM, + HIGH, + CRITICAL; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MessageStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MessageStats.java new file mode 100644 index 00000000..b9c9cebb --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MessageStats.java @@ -0,0 +1,103 @@ +package com.offlineprotocol.sdk; + +public class MessageStats { + private java.lang.String messageId; + private long sentAtMs; + private java.lang.Long deliveredAtMs; + private byte hopCount; + private java.lang.String status; + + public MessageStats( + java.lang.String messageId, + long sentAtMs, + java.lang.Long deliveredAtMs, + byte hopCount, + java.lang.String status + ) { + + this.messageId = messageId; + + this.sentAtMs = sentAtMs; + + this.deliveredAtMs = deliveredAtMs; + + this.hopCount = hopCount; + + this.status = status; + } + + public java.lang.String messageId() { + return this.messageId; + } + + public long sentAtMs() { + return this.sentAtMs; + } + + public java.lang.Long deliveredAtMs() { + return this.deliveredAtMs; + } + + public byte hopCount() { + return this.hopCount; + } + + public java.lang.String status() { + return this.status; + } + public void setMessageId(java.lang.String messageId) { + this.messageId = messageId; + } + public void setSentAtMs(long sentAtMs) { + this.sentAtMs = sentAtMs; + } + public void setDeliveredAtMs(java.lang.Long deliveredAtMs) { + this.deliveredAtMs = deliveredAtMs; + } + public void setHopCount(byte hopCount) { + this.hopCount = hopCount; + } + public void setStatus(java.lang.String status) { + this.status = status; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MessageStats) { + MessageStats _uniffiThat = (MessageStats) _uniffiOther; + return ( + java.util.Objects.equals(messageId, _uniffiThat.messageId) && + + sentAtMs == _uniffiThat.sentAtMs && + + java.util.Objects.equals(deliveredAtMs, _uniffiThat.deliveredAtMs) && + + hopCount == _uniffiThat.hopCount && + + java.util.Objects.equals(status, _uniffiThat.status) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(messageId); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(sentAtMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(deliveredAtMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(hopCount); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(status); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsAddMemberResult.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsAddMemberResult.java new file mode 100644 index 00000000..0c8e4e0b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsAddMemberResult.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + +public class MlsAddMemberResult { + private MlsWelcomeMessage welcome; + private MlsEncryptedMessage commit; + + public MlsAddMemberResult( + MlsWelcomeMessage welcome, + MlsEncryptedMessage commit + ) { + + this.welcome = welcome; + + this.commit = commit; + } + + public MlsWelcomeMessage welcome() { + return this.welcome; + } + + public MlsEncryptedMessage commit() { + return this.commit; + } + public void setWelcome(MlsWelcomeMessage welcome) { + this.welcome = welcome; + } + public void setCommit(MlsEncryptedMessage commit) { + this.commit = commit; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MlsAddMemberResult) { + MlsAddMemberResult _uniffiThat = (MlsAddMemberResult) _uniffiOther; + return ( + java.util.Objects.equals(welcome, _uniffiThat.welcome) && + + java.util.Objects.equals(commit, _uniffiThat.commit) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(welcome); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(commit); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsEncryptedMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsEncryptedMessage.java new file mode 100644 index 00000000..74f3b249 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsEncryptedMessage.java @@ -0,0 +1,117 @@ +package com.offlineprotocol.sdk; + +public class MlsEncryptedMessage { + private java.lang.String groupId; + private java.lang.String messageType; + private long epoch; + private java.util.List ciphertext; + private java.lang.String senderId; + private long timestampMs; + + public MlsEncryptedMessage( + java.lang.String groupId, + java.lang.String messageType, + long epoch, + java.util.List ciphertext, + java.lang.String senderId, + long timestampMs + ) { + + this.groupId = groupId; + + this.messageType = messageType; + + this.epoch = epoch; + + this.ciphertext = ciphertext; + + this.senderId = senderId; + + this.timestampMs = timestampMs; + } + + public java.lang.String groupId() { + return this.groupId; + } + + public java.lang.String messageType() { + return this.messageType; + } + + public long epoch() { + return this.epoch; + } + + public java.util.List ciphertext() { + return this.ciphertext; + } + + public java.lang.String senderId() { + return this.senderId; + } + + public long timestampMs() { + return this.timestampMs; + } + public void setGroupId(java.lang.String groupId) { + this.groupId = groupId; + } + public void setMessageType(java.lang.String messageType) { + this.messageType = messageType; + } + public void setEpoch(long epoch) { + this.epoch = epoch; + } + public void setCiphertext(java.util.List ciphertext) { + this.ciphertext = ciphertext; + } + public void setSenderId(java.lang.String senderId) { + this.senderId = senderId; + } + public void setTimestampMs(long timestampMs) { + this.timestampMs = timestampMs; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MlsEncryptedMessage) { + MlsEncryptedMessage _uniffiThat = (MlsEncryptedMessage) _uniffiOther; + return ( + java.util.Objects.equals(groupId, _uniffiThat.groupId) && + + java.util.Objects.equals(messageType, _uniffiThat.messageType) && + + epoch == _uniffiThat.epoch && + + java.util.Objects.equals(ciphertext, _uniffiThat.ciphertext) && + + java.util.Objects.equals(senderId, _uniffiThat.senderId) && + + timestampMs == _uniffiThat.timestampMs + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(groupId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(messageType); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(epoch); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(ciphertext); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(senderId); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(timestampMs); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsGroupInfo.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsGroupInfo.java new file mode 100644 index 00000000..07477409 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsGroupInfo.java @@ -0,0 +1,131 @@ +package com.offlineprotocol.sdk; + +public class MlsGroupInfo { + private java.lang.String groupId; + private java.lang.String name; + private java.util.List members; + private long epoch; + private boolean isSession; + private long createdAtMs; + private long lastActivityMs; + + public MlsGroupInfo( + java.lang.String groupId, + java.lang.String name, + java.util.List members, + long epoch, + boolean isSession, + long createdAtMs, + long lastActivityMs + ) { + + this.groupId = groupId; + + this.name = name; + + this.members = members; + + this.epoch = epoch; + + this.isSession = isSession; + + this.createdAtMs = createdAtMs; + + this.lastActivityMs = lastActivityMs; + } + + public java.lang.String groupId() { + return this.groupId; + } + + public java.lang.String name() { + return this.name; + } + + public java.util.List members() { + return this.members; + } + + public long epoch() { + return this.epoch; + } + + public boolean isSession() { + return this.isSession; + } + + public long createdAtMs() { + return this.createdAtMs; + } + + public long lastActivityMs() { + return this.lastActivityMs; + } + public void setGroupId(java.lang.String groupId) { + this.groupId = groupId; + } + public void setName(java.lang.String name) { + this.name = name; + } + public void setMembers(java.util.List members) { + this.members = members; + } + public void setEpoch(long epoch) { + this.epoch = epoch; + } + public void setIsSession(boolean isSession) { + this.isSession = isSession; + } + public void setCreatedAtMs(long createdAtMs) { + this.createdAtMs = createdAtMs; + } + public void setLastActivityMs(long lastActivityMs) { + this.lastActivityMs = lastActivityMs; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MlsGroupInfo) { + MlsGroupInfo _uniffiThat = (MlsGroupInfo) _uniffiOther; + return ( + java.util.Objects.equals(groupId, _uniffiThat.groupId) && + + java.util.Objects.equals(name, _uniffiThat.name) && + + java.util.Objects.equals(members, _uniffiThat.members) && + + epoch == _uniffiThat.epoch && + + isSession == _uniffiThat.isSession && + + createdAtMs == _uniffiThat.createdAtMs && + + lastActivityMs == _uniffiThat.lastActivityMs + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(groupId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(name); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(members); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(epoch); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(isSession); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(createdAtMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(lastActivityMs); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsKeyPackageBundle.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsKeyPackageBundle.java new file mode 100644 index 00000000..60727a42 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsKeyPackageBundle.java @@ -0,0 +1,117 @@ +package com.offlineprotocol.sdk; + +public class MlsKeyPackageBundle { + private java.lang.String packageId; + private java.lang.String userId; + private java.util.List keyPackageData; + private long createdAtMs; + private long expiresAtMs; + private boolean synced; + + public MlsKeyPackageBundle( + java.lang.String packageId, + java.lang.String userId, + java.util.List keyPackageData, + long createdAtMs, + long expiresAtMs, + boolean synced + ) { + + this.packageId = packageId; + + this.userId = userId; + + this.keyPackageData = keyPackageData; + + this.createdAtMs = createdAtMs; + + this.expiresAtMs = expiresAtMs; + + this.synced = synced; + } + + public java.lang.String packageId() { + return this.packageId; + } + + public java.lang.String userId() { + return this.userId; + } + + public java.util.List keyPackageData() { + return this.keyPackageData; + } + + public long createdAtMs() { + return this.createdAtMs; + } + + public long expiresAtMs() { + return this.expiresAtMs; + } + + public boolean synced() { + return this.synced; + } + public void setPackageId(java.lang.String packageId) { + this.packageId = packageId; + } + public void setUserId(java.lang.String userId) { + this.userId = userId; + } + public void setKeyPackageData(java.util.List keyPackageData) { + this.keyPackageData = keyPackageData; + } + public void setCreatedAtMs(long createdAtMs) { + this.createdAtMs = createdAtMs; + } + public void setExpiresAtMs(long expiresAtMs) { + this.expiresAtMs = expiresAtMs; + } + public void setSynced(boolean synced) { + this.synced = synced; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MlsKeyPackageBundle) { + MlsKeyPackageBundle _uniffiThat = (MlsKeyPackageBundle) _uniffiOther; + return ( + java.util.Objects.equals(packageId, _uniffiThat.packageId) && + + java.util.Objects.equals(userId, _uniffiThat.userId) && + + java.util.Objects.equals(keyPackageData, _uniffiThat.keyPackageData) && + + createdAtMs == _uniffiThat.createdAtMs && + + expiresAtMs == _uniffiThat.expiresAtMs && + + synced == _uniffiThat.synced + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(packageId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(userId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(keyPackageData); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(createdAtMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(expiresAtMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(synced); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageException.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageException.java new file mode 100644 index 00000000..be9acf7a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageException.java @@ -0,0 +1,37 @@ +package com.offlineprotocol.sdk; + + + +public class MlsStorageException extends java.lang.Exception { + private MlsStorageException(java.lang.String message) { + super(message); + } + + public static class StoreFailed extends MlsStorageException { + public StoreFailed(java.lang.String message) { + super(message); + } + } + public static class LoadFailed extends MlsStorageException { + public LoadFailed(java.lang.String message) { + super(message); + } + } + public static class DeleteFailed extends MlsStorageException { + public DeleteFailed(java.lang.String message) { + super(message); + } + } + public static class KeyNotFound extends MlsStorageException { + public KeyNotFound(java.lang.String message) { + super(message); + } + } + public static class CorruptedData extends MlsStorageException { + public CorruptedData(java.lang.String message) { + super(message); + } + } + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageExceptionErrorHandler.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageExceptionErrorHandler.java new file mode 100644 index 00000000..8908d0b9 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageExceptionErrorHandler.java @@ -0,0 +1,10 @@ +package com.offlineprotocol.sdk; + + +public class MlsStorageExceptionErrorHandler implements UniffiRustCallStatusErrorHandler { + @Override + public MlsStorageException lift(java.lang.foreign.MemorySegment errorBuf){ + return FfiConverterTypeMlsStorageError.INSTANCE.lift(errorBuf); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageProvider.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageProvider.java new file mode 100644 index 00000000..24dbbcab --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsStorageProvider.java @@ -0,0 +1,9 @@ +package com.offlineprotocol.sdk; + +public interface MlsStorageProvider { + public void store(java.lang.String keyType, java.lang.String keyId, java.util.List data) throws MlsStorageException; + public java.util.List load(java.lang.String keyType, java.lang.String keyId) throws MlsStorageException; + public void delete(java.lang.String keyType, java.lang.String keyId) throws MlsStorageException; + public java.util.List listKeys(java.lang.String keyType) throws MlsStorageException; + +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsVerbosity.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsVerbosity.java new file mode 100644 index 00000000..34e3ebb6 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsVerbosity.java @@ -0,0 +1,16 @@ +package com.offlineprotocol.sdk; + + + +public enum MlsVerbosity { + OFF, + LIFECYCLE, + DIAGNOSTIC; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsWelcomeMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsWelcomeMessage.java new file mode 100644 index 00000000..4b27cb5c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/MlsWelcomeMessage.java @@ -0,0 +1,103 @@ +package com.offlineprotocol.sdk; + +public class MlsWelcomeMessage { + private java.lang.String groupId; + private java.util.List welcomeData; + private java.lang.String inviterId; + private java.lang.String groupName; + private long timestampMs; + + public MlsWelcomeMessage( + java.lang.String groupId, + java.util.List welcomeData, + java.lang.String inviterId, + java.lang.String groupName, + long timestampMs + ) { + + this.groupId = groupId; + + this.welcomeData = welcomeData; + + this.inviterId = inviterId; + + this.groupName = groupName; + + this.timestampMs = timestampMs; + } + + public java.lang.String groupId() { + return this.groupId; + } + + public java.util.List welcomeData() { + return this.welcomeData; + } + + public java.lang.String inviterId() { + return this.inviterId; + } + + public java.lang.String groupName() { + return this.groupName; + } + + public long timestampMs() { + return this.timestampMs; + } + public void setGroupId(java.lang.String groupId) { + this.groupId = groupId; + } + public void setWelcomeData(java.util.List welcomeData) { + this.welcomeData = welcomeData; + } + public void setInviterId(java.lang.String inviterId) { + this.inviterId = inviterId; + } + public void setGroupName(java.lang.String groupName) { + this.groupName = groupName; + } + public void setTimestampMs(long timestampMs) { + this.timestampMs = timestampMs; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof MlsWelcomeMessage) { + MlsWelcomeMessage _uniffiThat = (MlsWelcomeMessage) _uniffiOther; + return ( + java.util.Objects.equals(groupId, _uniffiThat.groupId) && + + java.util.Objects.equals(welcomeData, _uniffiThat.welcomeData) && + + java.util.Objects.equals(inviterId, _uniffiThat.inviterId) && + + java.util.Objects.equals(groupName, _uniffiThat.groupName) && + + timestampMs == _uniffiThat.timestampMs + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(groupId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(welcomeData); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(inviterId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(groupName); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(timestampMs); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/NamespaceLibrary.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/NamespaceLibrary.java new file mode 100644 index 00000000..1cafa49d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/NamespaceLibrary.java @@ -0,0 +1,742 @@ +package com.offlineprotocol.sdk; + + +final class NamespaceLibrary { + static synchronized String findLibraryName(String componentName) { + String libOverride = System.getProperty("uniffi.component." + componentName + ".libraryOverride"); + if (libOverride != null) { + return libOverride; + } + return "offline_protocol_uniffi"; + } + + static java.lang.foreign.SymbolLookup loadLibrary() { + String name = findLibraryName("offline_protocol"); + if (name.startsWith("/") // Unix absolute path + || name.startsWith("\\\\") // Windows UNC path + || (name.length() > 2 && name.charAt(1) == ':')) // Windows drive path (e.g. C:\) + { + System.load(name); + } else { + System.loadLibrary(name); + } + return java.lang.foreign.SymbolLookup.loaderLookup(); + } + + static void uniffiCheckContractApiVersion() { + int bindingsContractVersion = 30; + int scaffoldingContractVersion = UniffiLib.ffi_offline_protocol_uniffi_uniffi_contract_version(); + if (bindingsContractVersion != scaffoldingContractVersion) { + throw new RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project"); + } + } + static void uniffiCheckApiChecksums() { + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_func_derive_address() != ((short) 64789)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_func_parse_invite() != ((short) 15865)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_func_run_storage_conformance() != ((short) 20699)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_func_verify_identity_assertion() != ((short) 61480)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_attachment_hash() != ((short) 10852)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_increment() != ((short) 50001)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_value() != ((short) 19947)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_create_doc() != ((short) 43277)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_decline_attachment() != ((short) 53249)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_delete_doc() != ((short) 23496)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_json() != ((short) 62388)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_size() != ((short) 1306)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_export_raw() != ((short) 30993)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment() != ((short) 2774)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment_from() != ((short) 44676)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_flush() != ((short) 4911)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_flush_all() != ((short) 58838)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_list_delete() != ((short) 46614)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_list_docs() != ((short) 43688)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_list_len() != ((short) 53366)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_list_push() != ((short) 58133)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_list_spaces() != ((short) 25003)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_map_delete() != ((short) 61779)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_map_get_json() != ((short) 7048)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_map_set() != ((short) 60305)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_provide_attachment() != ((short) 57819)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_doc() != ((short) 58710)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_space() != ((short) 242)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_set_interest() != ((short) 5786)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_text_delete() != ((short) 12470)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_text_insert() != ((short) 42508)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_text_value() != ((short) 6495)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_datastore_wipe_all() != ((short) 58624)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_meshservices_discover_services() != ((short) 43941)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_meshservices_register_service() != ((short) 46597)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_meshservices_respond_to_service_request() != ((short) 20926)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_meshservices_send_service_request() != ((short) 34689)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_meshservices_unregister_service() != ((short) 4997)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_accept_connection_request() != ((short) 50880)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_clear_peer_mtu() != ((short) 19884)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_fallback_count() != ((short) 60784)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_received() != ((short) 9764)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_next_fragment() != ((short) 30344)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_peer_count() != ((short) 11879)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_discovered() != ((short) 26789)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_lost() != ((short) 22804)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_recipient_not_among_peers_count() != ((short) 42065)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_return_fragment() != ((short) 51260)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_set_peer_mtu() != ((short) 7996)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_status_changed() != ((short) 63523)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_undersized_mtu_reports() != ((short) 53668)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_block_user() != ((short) 27957)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_connection_request() != ((short) 17522)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_file_transfer() != ((short) 44634)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_close_file_stores() != ((short) 57369)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_group() != ((short) 13199)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_invite() != ((short) 21745)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_derive_user_id_from_public_key() != ((short) 46701)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_disable_telemetry() != ((short) 12013)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_emit_test_event() != ((short) 29503)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_enable_telemetry() != ((short) 52940)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_end_telemetry_session() != ((short) 55610)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_erase_custody() != ((short) 39575)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_establish_secure_session() != ((short) 52793)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_finalize_file() != ((short) 48884)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry() != ((short) 52440)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry_blocking() != ((short) 60745)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_force_transport() != ((short) 65079)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message() != ((short) 4746)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message_to_group() != ((short) 43987)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_gateway_address_declaration() != ((short) 21061)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_active_transports() != ((short) 23761)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_battery_level() != ((short) 56170)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_blocked_users() != ((short) 28218)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_custody_stats() != ((short) 29466)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dedup_stats() != ((short) 51917)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_delivery_success_rate() != ((short) 23445)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dors_config() != ((short) 10752)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_establishment_state() != ((short) 61148)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_file_progress() != ((short) 25115)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_info() != ((short) 11773)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_roles() != ((short) 19243)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_identity_public_key() != ((short) 48103)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_is_charging() != ((short) 42857)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_hops() != ((short) 54486)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_latency() != ((short) 20827)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_member_role() != ((short) 5518)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_stats() != ((short) 29444)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_tunables() != ((short) 34919)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_message_stats() != ((short) 26794)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_pending_ack_count() != ((short) 14526)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_config() != ((short) 41352)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_priority() != ((short) 56317)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_retry_queue_size() != ((short) 11855)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_state() != ((short) 56454)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_topology() != ((short) 14852)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_transport_metrics() != ((short) 47103)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_relay_sync_state() != ((short) 2982)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_rich_readiness() != ((short) 33044)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_has_pending_key_package() != ((short) 50833)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_identity_assertion() != ((short) 12802)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls() != ((short) 28255)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls_with_file_stores() != ((short) 54918)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declaration_refused() != ((short) 52855)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declared() != ((short) 5462)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_confirm_sent() != ((short) 22824)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_get_next_message() != ((short) 42018)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_group_report_received() != ((short) 12840)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_message_received() != ((short) 4763)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_peer_presence() != ((short) 6161)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_presence_watchlist() != ((short) 9479)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_relay_capabilities() != ((short) 379)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed() != ((short) 12455)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed_with_reason() != ((short) 50456)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_status_changed() != ((short) 58507)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_invite_to_group() != ((short) 38704)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_mls_initialized() != ((short) 58599)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_relay() != ((short) 22217)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_user_blocked() != ((short) 9262)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_leave_group() != ((short) 13144)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_list_groups() != ((short) 26113)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_local_address() != ((short) 54626)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_clear_pending_welcome() != ((short) 33145)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_create_session() != ((short) 13710)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt() != ((short) 22215)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt_from_user() != ((short) 29387)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_delete_session() != ((short) 11647)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_encrypt_for_user() != ((short) 1970)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_generate_key_package() != ((short) 34344)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_or_create_key_package() != ((short) 26823)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_key_packages() != ((short) 3234)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_welcome() != ((short) 39261)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_has_session() != ((short) 56067)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_import_key_package() != ((short) 44533)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_join_session() != ((short) 14485)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_list_sessions() != ((short) 23429)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_mark_key_package_synced() != ((short) 6355)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_process_welcome() != ((short) 12812)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_confirm_sent() != ((short) 9310)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_message() != ((short) 20908)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_query() != ((short) 23327)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_public_key() != ((short) 59792)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_subscription_filter() != ((short) 35803)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received() != ((short) 32701)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received_at() != ((short) 4372)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_completed() != ((short) 45714)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_event_received() != ((short) 35705)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed() != ((short) 34587)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed_with_reason() != ((short) 46967)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_status_changed() != ((short) 10042)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_notify_app_state() != ((short) 64828)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_pause() != ((short) 2754)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_poll_event() != ((short) 2150)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process() != ((short) 28590)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process_file_chunk() != ((short) 38467)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_protocol_lock_diagnostics() != ((short) 63421)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_receive_message() != ((short) 24572)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reject_connection_request() != ((short) 17619)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rekey_session() != ((short) 49857)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_release_transport_lock() != ((short) 9066)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_from_group() != ((short) 50435)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_transport() != ((short) 37995)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rename_group() != ((short) 36114)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_request_group_relay_registration() != ((short) 3982)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resolve_username() != ((short) 56081)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resume() != ((short) 23596)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declaration_refused() != ((short) 6207)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declared() != ((short) 14810)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_confirm_sent() != ((short) 49416)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_gateway_capabilities() != ((short) 38346)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_get_next_message() != ((short) 43573)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_message_received() != ((short) 6557)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_peer_presence() != ((short) 9523)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_presence_watchlist() != ((short) 26815)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed() != ((short) 54693)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed_with_reason() != ((short) 59249)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_status_changed() != ((short) 14680)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_connection_request() != ((short) 32445)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_file() != ((short) 51826)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_group_message() != ((short) 11928)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media() != ((short) 26391)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media_rich() != ((short) 17024)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message() != ((short) 58608)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message_rich() != ((short) 3404)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_presence_update() != ((short) 56108)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_read_receipt() != ((short) 4730)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_typing_indicator() != ((short) 7836)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_level() != ((short) 44179)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_state() != ((short) 59397)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_ble_transport_callback() != ((short) 15468)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_event_callback() != ((short) 57350)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_member_role() != ((short) 9132)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_nostr_transport_callback() != ((short) 36253)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_relay_priority() != ((short) 26597)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_reticulum_transport_callback() != ((short) 53618)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_telemetry_enabled() != ((short) 65413)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_wifi_direct_transport_callback() != ((short) 33195)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_should_escalate_to_wifi() != ((short) 36523)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data() != ((short) 58338)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data_bytes() != ((short) 21454)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_start() != ((short) 63301)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_stop() != ((short) 30235)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_install_id() != ((short) 43250)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_stats() != ((short) 57652)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_unblock_user() != ((short) 52650)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_ack_config() != ((short) 50568)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dedup_config() != ((short) 37188)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dors_config() != ((short) 42995)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_relay_config() != ((short) 33211)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_retry_config() != ((short) 3523)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_transport_metrics() != ((short) 15902)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature() != ((short) 16718)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature_bytes() != ((short) 24438)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_get_next_message() != ((short) 50868)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_message_received() != ((short) 59107)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_connected() != ((short) 38596)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_disconnected() != ((short) 15986)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_status_changed() != ((short) 12337)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_constructor_datastore_new() != ((short) 36671)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_constructor_datastore_with_storage() != ((short) 2283)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_constructor_meshservices_new() != ((short) 61363)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_constructor_offlineprotocol_new() != ((short) 30125)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_bletransportcallback_on_fragments_available() != ((short) 43182)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_eventcallback_on_event() != ((short) 15485)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_store() != ((short) 9534)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_load() != ((short) 33472)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_delete() != ((short) 40050)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_list_keys() != ((short) 29193)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_nostrtransportcallback_on_messages_available() != ((short) 6903)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_store() != ((short) 40025)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_load() != ((short) 12081)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_delete() != ((short) 51503)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_list_keys() != ((short) 5874)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_reticulumtransportcallback_on_messages_available() != ((short) 26982)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + if (UniffiLib.uniffi_offline_protocol_uniffi_checksum_method_wifidirecttransportcallback_on_messages_available() != ((short) 16192)) { + throw new RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project"); + } + } +} + +// Define FFI callback types diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkLink.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkLink.java new file mode 100644 index 00000000..d96a5925 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkLink.java @@ -0,0 +1,89 @@ +package com.offlineprotocol.sdk; + +public class NetworkLink { + private java.lang.String sourceId; + private java.lang.String targetId; + private java.lang.String transport; + private float quality; + + public NetworkLink( + java.lang.String sourceId, + java.lang.String targetId, + java.lang.String transport, + float quality + ) { + + this.sourceId = sourceId; + + this.targetId = targetId; + + this.transport = transport; + + this.quality = quality; + } + + public java.lang.String sourceId() { + return this.sourceId; + } + + public java.lang.String targetId() { + return this.targetId; + } + + public java.lang.String transport() { + return this.transport; + } + + public float quality() { + return this.quality; + } + public void setSourceId(java.lang.String sourceId) { + this.sourceId = sourceId; + } + public void setTargetId(java.lang.String targetId) { + this.targetId = targetId; + } + public void setTransport(java.lang.String transport) { + this.transport = transport; + } + public void setQuality(float quality) { + this.quality = quality; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof NetworkLink) { + NetworkLink _uniffiThat = (NetworkLink) _uniffiOther; + return ( + java.util.Objects.equals(sourceId, _uniffiThat.sourceId) && + + java.util.Objects.equals(targetId, _uniffiThat.targetId) && + + java.util.Objects.equals(transport, _uniffiThat.transport) && + + java.lang.Float.compare(quality, _uniffiThat.quality) == 0 + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(sourceId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(targetId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(transport); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(quality); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkNode.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkNode.java new file mode 100644 index 00000000..d87b7967 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkNode.java @@ -0,0 +1,117 @@ +package com.offlineprotocol.sdk; + +public class NetworkNode { + private java.lang.String nodeId; + private java.lang.String role; + private java.lang.Short rssi; + private java.lang.Byte batteryLevel; + private int connectionCount; + private long lastSeenMs; + + public NetworkNode( + java.lang.String nodeId, + java.lang.String role, + java.lang.Short rssi, + java.lang.Byte batteryLevel, + int connectionCount, + long lastSeenMs + ) { + + this.nodeId = nodeId; + + this.role = role; + + this.rssi = rssi; + + this.batteryLevel = batteryLevel; + + this.connectionCount = connectionCount; + + this.lastSeenMs = lastSeenMs; + } + + public java.lang.String nodeId() { + return this.nodeId; + } + + public java.lang.String role() { + return this.role; + } + + public java.lang.Short rssi() { + return this.rssi; + } + + public java.lang.Byte batteryLevel() { + return this.batteryLevel; + } + + public int connectionCount() { + return this.connectionCount; + } + + public long lastSeenMs() { + return this.lastSeenMs; + } + public void setNodeId(java.lang.String nodeId) { + this.nodeId = nodeId; + } + public void setRole(java.lang.String role) { + this.role = role; + } + public void setRssi(java.lang.Short rssi) { + this.rssi = rssi; + } + public void setBatteryLevel(java.lang.Byte batteryLevel) { + this.batteryLevel = batteryLevel; + } + public void setConnectionCount(int connectionCount) { + this.connectionCount = connectionCount; + } + public void setLastSeenMs(long lastSeenMs) { + this.lastSeenMs = lastSeenMs; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof NetworkNode) { + NetworkNode _uniffiThat = (NetworkNode) _uniffiOther; + return ( + java.util.Objects.equals(nodeId, _uniffiThat.nodeId) && + + java.util.Objects.equals(role, _uniffiThat.role) && + + java.util.Objects.equals(rssi, _uniffiThat.rssi) && + + java.util.Objects.equals(batteryLevel, _uniffiThat.batteryLevel) && + + connectionCount == _uniffiThat.connectionCount && + + lastSeenMs == _uniffiThat.lastSeenMs + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(nodeId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(role); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(rssi); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(batteryLevel); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(connectionCount); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(lastSeenMs); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkTopology.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkTopology.java new file mode 100644 index 00000000..f01028d0 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/NetworkTopology.java @@ -0,0 +1,75 @@ +package com.offlineprotocol.sdk; + +public class NetworkTopology { + private java.util.List nodes; + private java.util.List links; + private java.util.List messageStats; + + public NetworkTopology( + java.util.List nodes, + java.util.List links, + java.util.List messageStats + ) { + + this.nodes = nodes; + + this.links = links; + + this.messageStats = messageStats; + } + + public java.util.List nodes() { + return this.nodes; + } + + public java.util.List links() { + return this.links; + } + + public java.util.List messageStats() { + return this.messageStats; + } + public void setNodes(java.util.List nodes) { + this.nodes = nodes; + } + public void setLinks(java.util.List links) { + this.links = links; + } + public void setMessageStats(java.util.List messageStats) { + this.messageStats = messageStats; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof NetworkTopology) { + NetworkTopology _uniffiThat = (NetworkTopology) _uniffiOther; + return ( + java.util.Objects.equals(nodes, _uniffiThat.nodes) && + + java.util.Objects.equals(links, _uniffiThat.links) && + + java.util.Objects.equals(messageStats, _uniffiThat.messageStats) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(nodes); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(links); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(messageStats); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/NoHandle.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/NoHandle.java new file mode 100644 index 00000000..7e04e676 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/NoHandle.java @@ -0,0 +1,11 @@ +package com.offlineprotocol.sdk; + + +public class NoHandle { + // Private constructor to prevent instantiation + private NoHandle() {} + + // Static final instance of the class so it can be used in tests + public static final NoHandle INSTANCE = new NoHandle(); +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrMessage.java new file mode 100644 index 00000000..8ff37455 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrMessage.java @@ -0,0 +1,75 @@ +package com.offlineprotocol.sdk; + +public class NostrMessage { + private java.lang.String messageId; + private java.lang.String eventId; + private java.lang.String eventJson; + + public NostrMessage( + java.lang.String messageId, + java.lang.String eventId, + java.lang.String eventJson + ) { + + this.messageId = messageId; + + this.eventId = eventId; + + this.eventJson = eventJson; + } + + public java.lang.String messageId() { + return this.messageId; + } + + public java.lang.String eventId() { + return this.eventId; + } + + public java.lang.String eventJson() { + return this.eventJson; + } + public void setMessageId(java.lang.String messageId) { + this.messageId = messageId; + } + public void setEventId(java.lang.String eventId) { + this.eventId = eventId; + } + public void setEventJson(java.lang.String eventJson) { + this.eventJson = eventJson; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof NostrMessage) { + NostrMessage _uniffiThat = (NostrMessage) _uniffiOther; + return ( + java.util.Objects.equals(messageId, _uniffiThat.messageId) && + + java.util.Objects.equals(eventId, _uniffiThat.eventId) && + + java.util.Objects.equals(eventJson, _uniffiThat.eventJson) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(messageId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(eventId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(eventJson); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrQuery.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrQuery.java new file mode 100644 index 00000000..988f7fec --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrQuery.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + +public class NostrQuery { + private java.lang.String queryId; + private java.lang.String reqJson; + + public NostrQuery( + java.lang.String queryId, + java.lang.String reqJson + ) { + + this.queryId = queryId; + + this.reqJson = reqJson; + } + + public java.lang.String queryId() { + return this.queryId; + } + + public java.lang.String reqJson() { + return this.reqJson; + } + public void setQueryId(java.lang.String queryId) { + this.queryId = queryId; + } + public void setReqJson(java.lang.String reqJson) { + this.reqJson = reqJson; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof NostrQuery) { + NostrQuery _uniffiThat = (NostrQuery) _uniffiOther; + return ( + java.util.Objects.equals(queryId, _uniffiThat.queryId) && + + java.util.Objects.equals(reqJson, _uniffiThat.reqJson) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(queryId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(reqJson); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrTransportCallback.java new file mode 100644 index 00000000..11d03c9a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/NostrTransportCallback.java @@ -0,0 +1,6 @@ +package com.offlineprotocol.sdk; + +public interface NostrTransportCallback { + public void onMessagesAvailable(); + +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocol.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocol.java new file mode 100644 index 00000000..023c6010 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocol.java @@ -0,0 +1,5925 @@ +package com.offlineprotocol.sdk; + +public class OfflineProtocol implements AutoCloseable, OfflineProtocolInterface { + protected long handle; + protected UniffiCleaner.Cleanable cleanable; + + private java.util.concurrent.atomic.AtomicBoolean wasDestroyed = new java.util.concurrent.atomic.AtomicBoolean(false); + private java.util.concurrent.atomic.AtomicLong callCounter = new java.util.concurrent.atomic.AtomicLong(1); + + /** + * Internal constructor to wrap a raw handle from FFI. + * The UniffiWithHandle marker disambiguates this from other constructors. + */ + public OfflineProtocol(UniffiWithHandle phantom, long handle) { + this.handle = handle; + this.cleanable = UniffiLib.CLEANER.register(this, new UniffiCleanAction(handle)); + } + + /** + * This constructor can be used to instantiate a fake object. Only used for tests. Any + * attempt to actually use an object constructed this way will fail as there is no + * connected Rust object. + */ + public OfflineProtocol(NoHandle noHandle) { + this.handle = 0L; + this.cleanable = null; + } + + + public OfflineProtocol(ProtocolConfig config) throws ProtocolException{ + this(UniffiWithHandle.INSTANCE, (long) + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_constructor_offlineprotocol_new( + FfiConverterTypeProtocolConfig.INSTANCE.lower(config), _status); + }) + ); + } + + @Override + public synchronized void close() { + // Only allow a single call to this method. + // TODO(uniffi): maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + if (cleanable != null) { + cleanable.clean(); + } + } + } + } + + public R callWithHandle(java.util.function.Function block) { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + long c; + do { + c = this.callCounter.get(); + if (c == 0L) { + throw new java.lang.IllegalStateException("OfflineProtocol object has already been destroyed"); + } + if (c == java.lang.Long.MAX_VALUE) { + throw new java.lang.IllegalStateException("OfflineProtocol call counter would overflow"); + } + } while (! this.callCounter.compareAndSet(c, c + 1L)); + // Now we can safely do the method call without the handle being freed concurrently. + try { + return block.apply(this.uniffiCloneHandle()); + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + if (cleanable != null) { + cleanable.clean(); + } + } + } + } + + public void callWithHandle(java.util.function.Consumer block) { + callWithHandle((java.lang.Long uniffiHandle) -> { + block.accept(uniffiHandle); + return (java.lang.Void)null; + }); + } + + private class UniffiCleanAction implements Runnable { + private final long handle; + + public UniffiCleanAction(long handle) { + this.handle = handle; + } + + @Override + public void run() { + // If the handle is 0 this is a fake object created with `NoHandle`, don't try to free. + if (handle != 0L) { + UniffiHelpers.uniffiRustCall((_allocator, status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_free_offlineprotocol(handle, status); + return null; + }); + } + } + } + + long uniffiCloneHandle() { + return UniffiHelpers.uniffiRustCall((_allocator, status) -> { + if (handle == 0L) { + throw new java.lang.NullPointerException(); + } + return UniffiLib.uniffi_offline_protocol_uniffi_fn_clone_offlineprotocol(handle, status); + }); + } + + + @Override + public java.lang.String acceptConnectionRequest(java.lang.String recipient, java.lang.String accepterName, java.util.List keyPackage) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_accept_connection_request(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterString.INSTANCE.lower(accepterName), FfiConverterOptionalSequenceByte.INSTANCE.lower(keyPackage), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void bleClearPeerMtu(java.lang.String peerId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_clear_peer_mtu(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public long bleFragmentFallbackCount() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallLong( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_fallback_count(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void bleFragmentReceived(java.lang.String senderId, java.util.List fragment) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_received(_uniffiHandle, + FfiConverterString.INSTANCE.lower(senderId), FfiConverterSequenceByte.INSTANCE.lower(fragment), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public BleFragment bleGetNextFragment() { + try { + return FfiConverterOptionalTypeBleFragment.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_next_fragment(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public int bleGetPeerCount() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallInt( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_peer_count(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void blePeerDiscovered(java.lang.String peerId, short rssi) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_discovered(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), rssi, _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void blePeerLost(java.lang.String peerId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_lost(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public long bleRecipientNotAmongPeersCount() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallLong( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_recipient_not_among_peers_count(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void bleReturnFragment() { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_return_fragment(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void bleSetPeerMtu(java.lang.String peerId, int maxPayload) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_set_peer_mtu(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), maxPayload, _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void bleStatusChanged(boolean isAvailable) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_status_changed(_uniffiHandle, + FfiConverterBoolean.INSTANCE.lower(isAvailable), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public long bleUndersizedMtuReports() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallLong( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_undersized_mtu_reports(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void blockUser(java.lang.String userId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_block_user(_uniffiHandle, + FfiConverterString.INSTANCE.lower(userId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String cancelConnectionRequest(java.lang.String recipient) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_connection_request(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void cancelFileTransfer(java.lang.String fileId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_file_transfer(_uniffiHandle, + FfiConverterString.INSTANCE.lower(fileId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void closeFileStores() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_close_file_stores(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsGroupInfo createGroup(java.lang.String groupName) throws ProtocolException { + try { + return FfiConverterTypeMlsGroupInfo.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_group(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(groupName), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String createInvite(java.lang.String petname, boolean sign) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_invite(_allocator, _uniffiHandle, + FfiConverterOptionalString.INSTANCE.lower(petname), FfiConverterBoolean.INSTANCE.lower(sign), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String deriveUserIdFromPublicKey(java.util.List publicKey) { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_derive_user_id_from_public_key(_allocator, _uniffiHandle, + FfiConverterSequenceByte.INSTANCE.lower(publicKey), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void disableTelemetry() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_disable_telemetry(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void emitTestEvent() { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_emit_test_event(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void enableTelemetry(TelemetryConfig config, AppState appState) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_enable_telemetry(_uniffiHandle, + FfiConverterTypeTelemetryConfig.INSTANCE.lower(config), FfiConverterTypeAppState.INSTANCE.lower(appState), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void endTelemetrySession() { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_end_telemetry_session(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void eraseCustody() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_erase_custody(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsWelcomeMessage establishSecureSession(java.lang.String peerId) throws ProtocolException { + try { + return FfiConverterOptionalTypeMlsWelcomeMessage.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_establish_secure_session(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void finalizeFile(java.lang.String fileId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_finalize_file(_uniffiHandle, + FfiConverterString.INSTANCE.lower(fileId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void flushTelemetry() { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean flushTelemetryBlocking(long deadlineMs) { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry_blocking(_uniffiHandle, + deadlineMs, _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void forceTransport(TransportType transportType) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_force_transport(_uniffiHandle, + FfiConverterTypeTransportType.INSTANCE.lower(transportType), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String forwardMessage(java.lang.String originalMessageJson, java.lang.String newRecipient, MessagePriority priority) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(originalMessageJson), FfiConverterString.INSTANCE.lower(newRecipient), FfiConverterOptionalTypeMessagePriority.INSTANCE.lower(priority), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List forwardMessageToGroup(java.lang.String originalMessageJson, java.lang.String groupId, MessagePriority priority) throws ProtocolException { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message_to_group(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(originalMessageJson), FfiConverterString.INSTANCE.lower(groupId), FfiConverterOptionalTypeMessagePriority.INSTANCE.lower(priority), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public GatewayAddressDeclaration gatewayAddressDeclaration(java.util.List challenge) throws ProtocolException { + try { + return FfiConverterTypeGatewayAddressDeclaration.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_gateway_address_declaration(_allocator, _uniffiHandle, + FfiConverterSequenceByte.INSTANCE.lower(challenge), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List getActiveTransports() { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_active_transports(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.Byte getBatteryLevel() { + try { + return FfiConverterOptionalByte.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_battery_level(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List getBlockedUsers() throws ProtocolException { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_blocked_users(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public CustodyStats getCustodyStats() { + try { + return FfiConverterTypeCustodyStats.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_custody_stats(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public DedupStats getDedupStats() { + try { + return FfiConverterTypeDedupStats.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dedup_stats(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public float getDeliverySuccessRate() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallFloat( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_delivery_success_rate(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public DorsConfig getDorsConfig() { + try { + return FfiConverterTypeDorsConfig.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dors_config(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public EstablishmentState getEstablishmentState(java.lang.String peerId) throws ProtocolException { + try { + return FfiConverterTypeEstablishmentState.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_establishment_state(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public FileProgress getFileProgress(java.lang.String fileId) { + try { + return FfiConverterOptionalTypeFileProgress.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_file_progress(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(fileId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsGroupInfo getGroupInfo(java.lang.String groupId) throws ProtocolException { + try { + return FfiConverterOptionalTypeMlsGroupInfo.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_info(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.Map getGroupRoles(java.lang.String groupId) throws ProtocolException { + try { + return FfiConverterMapStringString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_roles(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List getIdentityPublicKey() throws ProtocolException { + try { + return FfiConverterSequenceByte.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_identity_public_key(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean getIsCharging() { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_is_charging(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public byte getMedianHops() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallByte( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_hops(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public long getMedianLatency() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallLong( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_latency(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String getMemberRole(java.lang.String groupId, java.lang.String userId) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_member_role(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), FfiConverterString.INSTANCE.lower(userId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MeshRelayStats getMeshRelayStats() { + try { + return FfiConverterTypeMeshRelayStats.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_stats(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MeshRelayTunables getMeshRelayTunables() { + try { + return FfiConverterTypeMeshRelayTunables.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_tunables(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List getMessageStats() { + try { + return FfiConverterSequenceTypeMessageStats.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_message_stats(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public long getPendingAckCount() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallLong( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_pending_ack_count(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public RelayConfig getRelayConfig() { + try { + return FfiConverterTypeRelayConfig.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_config(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public RelayPriority getRelayPriority() { + try { + return FfiConverterTypeRelayPriority.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_priority(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public long getRetryQueueSize() { + try { + return + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallLong( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_retry_queue_size(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public ProtocolState getState() { + try { + return FfiConverterTypeProtocolState.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_state(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public NetworkTopology getTopology() throws ProtocolException { + try { + return FfiConverterTypeNetworkTopology.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_topology(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public TransportMetrics getTransportMetrics(TransportType transportType) { + try { + return FfiConverterOptionalTypeTransportMetrics.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_transport_metrics(_allocator, _uniffiHandle, + FfiConverterTypeTransportType.INSTANCE.lower(transportType), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public RelaySyncState groupRelaySyncState(java.lang.String groupId) throws ProtocolException { + try { + return FfiConverterTypeRelaySyncState.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_relay_sync_state(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public GroupRichReadiness groupRichReadiness(java.lang.String groupId) throws ProtocolException { + try { + return FfiConverterTypeGroupRichReadiness.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_rich_readiness(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean hasPendingKeyPackage(java.lang.String peerId) { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_has_pending_key_package(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List identityAssertion(java.util.List signedData) throws ProtocolException { + try { + return FfiConverterSequenceByte.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_identity_assertion(_allocator, _uniffiHandle, + FfiConverterSequenceByte.INSTANCE.lower(signedData), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void initializeMls(MlsStorageProvider secureStorage, ProtocolStateStorageProvider protocolStateStorage) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls(_uniffiHandle, + FfiConverterTypeMlsStorageProvider.INSTANCE.lower(secureStorage), FfiConverterTypeProtocolStateStorageProvider.INSTANCE.lower(protocolStateStorage), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void initializeMlsWithFileStores(java.lang.String mlsRoot, java.lang.String stateRoot, byte[] storeKey) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls_with_file_stores(_uniffiHandle, + FfiConverterString.INSTANCE.lower(mlsRoot), FfiConverterString.INSTANCE.lower(stateRoot), FfiConverterByteArray.INSTANCE.lower(storeKey), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetAddressDeclarationRefused(java.lang.String reason) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declaration_refused(_uniffiHandle, + FfiConverterString.INSTANCE.lower(reason), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetAddressDeclared(java.lang.String address) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declared(_uniffiHandle, + FfiConverterString.INSTANCE.lower(address), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetConfirmSent(java.lang.String messageId) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_confirm_sent(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public InternetMessage internetGetNextMessage() { + try { + return FfiConverterOptionalTypeInternetMessage.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_get_next_message(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetGroupReportReceived(java.lang.String reportJson) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_group_report_received(_uniffiHandle, + FfiConverterString.INSTANCE.lower(reportJson), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetMessageReceived(java.lang.String senderId, java.util.List data) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_message_received(_uniffiHandle, + FfiConverterString.INSTANCE.lower(senderId), FfiConverterSequenceByte.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetPeerPresence(java.lang.String peerId, boolean online, java.lang.Long lastSeenMs) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_peer_presence(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), FfiConverterBoolean.INSTANCE.lower(online), FfiConverterOptionalLong.INSTANCE.lower(lastSeenMs), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List internetPresenceWatchlist() { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_presence_watchlist(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetRelayCapabilities(java.util.List capabilities) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_relay_capabilities(_uniffiHandle, + FfiConverterSequenceString.INSTANCE.lower(capabilities), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetSendFailed(java.lang.String messageId) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetSendFailedWithReason(java.lang.String messageId, java.lang.String reason) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed_with_reason(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), FfiConverterOptionalString.INSTANCE.lower(reason), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void internetStatusChanged(boolean isConnected) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_status_changed(_uniffiHandle, + FfiConverterBoolean.INSTANCE.lower(isConnected), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void inviteToGroup(java.lang.String groupId, java.lang.String inviteeUserId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_invite_to_group(_uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), FfiConverterString.INSTANCE.lower(inviteeUserId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean isMlsInitialized() { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_mls_initialized(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean isRelay() { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_relay(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean isUserBlocked(java.lang.String userId) throws ProtocolException { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_user_blocked(_uniffiHandle, + FfiConverterString.INSTANCE.lower(userId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void leaveGroup(java.lang.String groupId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_leave_group(_uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List listGroups() throws ProtocolException { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_list_groups(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String localAddress() { + try { + return FfiConverterOptionalString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_local_address(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void mlsClearPendingWelcome(java.lang.String otherUserId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_clear_pending_welcome(_uniffiHandle, + FfiConverterString.INSTANCE.lower(otherUserId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsWelcomeMessage mlsCreateSession(java.lang.String otherUserId) throws ProtocolException { + try { + return FfiConverterTypeMlsWelcomeMessage.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_create_session(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(otherUserId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List mlsDecrypt(MlsEncryptedMessage encrypted) throws ProtocolException { + try { + return FfiConverterOptionalSequenceByte.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt(_allocator, _uniffiHandle, + FfiConverterTypeMlsEncryptedMessage.INSTANCE.lower(encrypted), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List mlsDecryptFromUser(MlsEncryptedMessage encrypted) throws ProtocolException { + try { + return FfiConverterOptionalSequenceByte.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt_from_user(_allocator, _uniffiHandle, + FfiConverterTypeMlsEncryptedMessage.INSTANCE.lower(encrypted), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void mlsDeleteSession(java.lang.String otherUserId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_delete_session(_uniffiHandle, + FfiConverterString.INSTANCE.lower(otherUserId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsEncryptedMessage mlsEncryptForUser(java.lang.String otherUserId, java.util.List plaintext) throws ProtocolException { + try { + return FfiConverterTypeMlsEncryptedMessage.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_encrypt_for_user(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(otherUserId), FfiConverterSequenceByte.INSTANCE.lower(plaintext), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsKeyPackageBundle mlsGenerateKeyPackage() throws ProtocolException { + try { + return FfiConverterTypeMlsKeyPackageBundle.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_generate_key_package(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsKeyPackageBundle mlsGetOrCreateKeyPackage() throws ProtocolException { + try { + return FfiConverterTypeMlsKeyPackageBundle.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_or_create_key_package(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List mlsGetPendingKeyPackages() { + try { + return FfiConverterSequenceTypeMlsKeyPackageBundle.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_key_packages(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsWelcomeMessage mlsGetPendingWelcome(java.lang.String otherUserId) { + try { + return FfiConverterOptionalTypeMlsWelcomeMessage.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_welcome(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(otherUserId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean mlsHasSession(java.lang.String otherUserId) { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_has_session(_uniffiHandle, + FfiConverterString.INSTANCE.lower(otherUserId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void mlsImportKeyPackage(java.lang.String userId, java.util.List keyPackageData) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_import_key_package(_uniffiHandle, + FfiConverterString.INSTANCE.lower(userId), FfiConverterSequenceByte.INSTANCE.lower(keyPackageData), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsGroupInfo mlsJoinSession(MlsWelcomeMessage welcome) throws ProtocolException { + try { + return FfiConverterTypeMlsGroupInfo.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_join_session(_allocator, _uniffiHandle, + FfiConverterTypeMlsWelcomeMessage.INSTANCE.lower(welcome), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List mlsListSessions() { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_list_sessions(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void mlsMarkKeyPackageSynced(java.lang.String packageId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_mark_key_package_synced(_uniffiHandle, + FfiConverterString.INSTANCE.lower(packageId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public MlsGroupInfo mlsProcessWelcome(MlsWelcomeMessage welcome) throws ProtocolException { + try { + return FfiConverterTypeMlsGroupInfo.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_process_welcome(_allocator, _uniffiHandle, + FfiConverterTypeMlsWelcomeMessage.INSTANCE.lower(welcome), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void nostrConfirmSent(java.lang.String messageId) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_confirm_sent(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public NostrMessage nostrGetNextMessage() { + try { + return FfiConverterOptionalTypeNostrMessage.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_message(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public NostrQuery nostrGetNextQuery() { + try { + return FfiConverterOptionalTypeNostrQuery.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_query(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String nostrGetPublicKey() { + try { + return FfiConverterOptionalString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_public_key(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String nostrGetSubscriptionFilter(java.lang.String subscriptionId) { + try { + return FfiConverterOptionalString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_subscription_filter(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(subscriptionId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void nostrMessageReceived(java.lang.String senderId, java.util.List data) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received(_uniffiHandle, + FfiConverterString.INSTANCE.lower(senderId), FfiConverterSequenceByte.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void nostrMessageReceivedAt(java.lang.String senderId, java.util.List data, long createdAt) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received_at(_uniffiHandle, + FfiConverterString.INSTANCE.lower(senderId), FfiConverterSequenceByte.INSTANCE.lower(data), createdAt, _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void nostrQueryCompleted(java.lang.String queryId) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_completed(_uniffiHandle, + FfiConverterString.INSTANCE.lower(queryId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void nostrQueryEventReceived(java.lang.String queryId, java.lang.String eventJson) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_event_received(_uniffiHandle, + FfiConverterString.INSTANCE.lower(queryId), FfiConverterString.INSTANCE.lower(eventJson), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void nostrSendFailed(java.lang.String messageId) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void nostrSendFailedWithReason(java.lang.String messageId, java.lang.String reason) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed_with_reason(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), FfiConverterOptionalString.INSTANCE.lower(reason), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void nostrStatusChanged(boolean isConnected) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_status_changed(_uniffiHandle, + FfiConverterBoolean.INSTANCE.lower(isConnected), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void notifyAppState(AppState state) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_notify_app_state(_uniffiHandle, + FfiConverterTypeAppState.INSTANCE.lower(state), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void pause() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_pause(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String pollEvent() { + try { + return FfiConverterOptionalString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_poll_event(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void process() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void processFileChunk(java.lang.String fileId, int chunkIndex, int totalChunks, long fileSize, java.lang.String fileName, java.lang.String fileChecksum, java.util.List data) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process_file_chunk(_uniffiHandle, + FfiConverterString.INSTANCE.lower(fileId), chunkIndex, totalChunks, fileSize, FfiConverterString.INSTANCE.lower(fileName), FfiConverterString.INSTANCE.lower(fileChecksum), FfiConverterSequenceByte.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public ProtocolLockDiagnostics protocolLockDiagnostics() { + try { + return FfiConverterTypeProtocolLockDiagnostics.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_protocol_lock_diagnostics(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String receiveMessage() { + try { + return FfiConverterOptionalString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_receive_message(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String rejectConnectionRequest(java.lang.String recipient) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reject_connection_request(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean rekeySession(java.lang.String peerId) throws ProtocolException { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rekey_session(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void releaseTransportLock() { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_release_transport_lock(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void removeFromGroup(java.lang.String groupId, java.lang.String memberId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_from_group(_uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), FfiConverterString.INSTANCE.lower(memberId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void removeTransport(TransportType transportType) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_transport(_uniffiHandle, + FfiConverterTypeTransportType.INSTANCE.lower(transportType), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void renameGroup(java.lang.String groupId, java.lang.String newName) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rename_group(_uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), FfiConverterString.INSTANCE.lower(newName), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean requestGroupRelayRegistration(java.lang.String groupId) throws ProtocolException { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_request_group_relay_registration(_uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean resolveUsername(java.lang.String username) throws ProtocolException { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resolve_username(_uniffiHandle, + FfiConverterString.INSTANCE.lower(username), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void resume() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resume(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumAddressDeclarationRefused(java.lang.String reason) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declaration_refused(_uniffiHandle, + FfiConverterString.INSTANCE.lower(reason), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumAddressDeclared(java.lang.String address) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declared(_uniffiHandle, + FfiConverterString.INSTANCE.lower(address), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumConfirmSent(java.lang.String messageId) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_confirm_sent(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumGatewayCapabilities(java.util.List capabilities) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_gateway_capabilities(_uniffiHandle, + FfiConverterSequenceString.INSTANCE.lower(capabilities), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public ReticulumMessage reticulumGetNextMessage() { + try { + return FfiConverterOptionalTypeReticulumMessage.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_get_next_message(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumMessageReceived(java.lang.String senderId, java.util.List data) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_message_received(_uniffiHandle, + FfiConverterString.INSTANCE.lower(senderId), FfiConverterSequenceByte.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumPeerPresence(java.lang.String peerId, boolean online, java.lang.Long lastSeenMs) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_peer_presence(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), FfiConverterBoolean.INSTANCE.lower(online), FfiConverterOptionalLong.INSTANCE.lower(lastSeenMs), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List reticulumPresenceWatchlist() { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_presence_watchlist(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumSendFailed(java.lang.String messageId) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumSendFailedWithReason(java.lang.String messageId, java.lang.String reason) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed_with_reason(_uniffiHandle, + FfiConverterString.INSTANCE.lower(messageId), FfiConverterOptionalString.INSTANCE.lower(reason), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void reticulumStatusChanged(boolean isConnected) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_status_changed(_uniffiHandle, + FfiConverterBoolean.INSTANCE.lower(isConnected), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendConnectionRequest(java.lang.String recipient, java.lang.String senderName, java.util.List keyPackage, java.lang.String initialMessage) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_connection_request(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterString.INSTANCE.lower(senderName), FfiConverterOptionalSequenceByte.INSTANCE.lower(keyPackage), FfiConverterOptionalString.INSTANCE.lower(initialMessage), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendFile(java.lang.String recipient, java.util.List fileData, java.lang.String fileName) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_file(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterSequenceByte.INSTANCE.lower(fileData), FfiConverterString.INSTANCE.lower(fileName), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List sendGroupMessage(java.lang.String groupId, java.lang.String content, MessagePriority priority, java.lang.String replyToMsg) throws ProtocolException { + try { + return FfiConverterSequenceString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_group_message(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), FfiConverterString.INSTANCE.lower(content), FfiConverterOptionalTypeMessagePriority.INSTANCE.lower(priority), FfiConverterOptionalString.INSTANCE.lower(replyToMsg), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendMedia(java.lang.String recipient, java.util.List fileData, java.lang.String fileName, ContentType contentType, MediaMetadata mediaMetadata) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterSequenceByte.INSTANCE.lower(fileData), FfiConverterString.INSTANCE.lower(fileName), FfiConverterTypeContentType.INSTANCE.lower(contentType), FfiConverterOptionalTypeMediaMetadata.INSTANCE.lower(mediaMetadata), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendMediaRich(java.lang.String recipient, java.util.List fileData, java.lang.String fileName, ContentType contentType, MediaSendOptions options) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media_rich(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterSequenceByte.INSTANCE.lower(fileData), FfiConverterString.INSTANCE.lower(fileName), FfiConverterTypeContentType.INSTANCE.lower(contentType), FfiConverterTypeMediaSendOptions.INSTANCE.lower(options), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendMessage(java.lang.String recipient, java.lang.String content, MessagePriority priority, java.lang.String replyToMsg) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterString.INSTANCE.lower(content), FfiConverterTypeMessagePriority.INSTANCE.lower(priority), FfiConverterOptionalString.INSTANCE.lower(replyToMsg), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendMessageRich(java.lang.String recipient, java.lang.String content, SendMessageOptions options) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message_rich(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterString.INSTANCE.lower(content), FfiConverterTypeSendMessageOptions.INSTANCE.lower(options), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendPresenceUpdate(java.lang.String recipient, PresenceStatus status) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_presence_update(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterTypePresenceStatus.INSTANCE.lower(status), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendReadReceipt(java.lang.String recipient, java.util.List messageIds) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_read_receipt(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterSequenceString.INSTANCE.lower(messageIds), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String sendTypingIndicator(java.lang.String recipient, java.lang.String conversationId, boolean isTyping) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_typing_indicator(_allocator, _uniffiHandle, + FfiConverterString.INSTANCE.lower(recipient), FfiConverterString.INSTANCE.lower(conversationId), FfiConverterBoolean.INSTANCE.lower(isTyping), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setBatteryLevel(byte level) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_level(_uniffiHandle, + level, _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setBatteryState(byte level, boolean isCharging) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_state(_uniffiHandle, + level, FfiConverterBoolean.INSTANCE.lower(isCharging), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setBleTransportCallback(BleTransportCallback callback) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_ble_transport_callback(_uniffiHandle, + FfiConverterTypeBleTransportCallback.INSTANCE.lower(callback), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setEventCallback(EventCallback callback) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_event_callback(_uniffiHandle, + FfiConverterTypeEventCallback.INSTANCE.lower(callback), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setMemberRole(java.lang.String groupId, java.lang.String userId, java.lang.String role) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_member_role(_uniffiHandle, + FfiConverterString.INSTANCE.lower(groupId), FfiConverterString.INSTANCE.lower(userId), FfiConverterString.INSTANCE.lower(role), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setNostrTransportCallback(NostrTransportCallback callback) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_nostr_transport_callback(_uniffiHandle, + FfiConverterTypeNostrTransportCallback.INSTANCE.lower(callback), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setRelayPriority(RelayPriority priority) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_relay_priority(_uniffiHandle, + FfiConverterTypeRelayPriority.INSTANCE.lower(priority), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setReticulumTransportCallback(ReticulumTransportCallback callback) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_reticulum_transport_callback(_uniffiHandle, + FfiConverterTypeReticulumTransportCallback.INSTANCE.lower(callback), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setTelemetryEnabled(boolean enabled) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_telemetry_enabled(_uniffiHandle, + FfiConverterBoolean.INSTANCE.lower(enabled), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void setWifiDirectTransportCallback(WifiDirectTransportCallback callback) { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_wifi_direct_transport_callback(_uniffiHandle, + FfiConverterTypeWifiDirectTransportCallback.INSTANCE.lower(callback), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean shouldEscalateToWifi() { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_should_escalate_to_wifi(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.util.List signData(java.util.List data) throws ProtocolException { + try { + return FfiConverterSequenceByte.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data(_allocator, _uniffiHandle, + FfiConverterSequenceByte.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public byte[] signDataBytes(byte[] data) throws ProtocolException { + try { + return FfiConverterByteArray.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data_bytes(_allocator, _uniffiHandle, + FfiConverterByteArray.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void start() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_start(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void stop() throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_stop(_uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public java.lang.String telemetryInstallId() { + try { + return FfiConverterOptionalString.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_install_id(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public TelemetryStats telemetryStats() { + try { + return FfiConverterOptionalTypeTelemetryStats.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_stats(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void unblockUser(java.lang.String userId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_unblock_user(_uniffiHandle, + FfiConverterString.INSTANCE.lower(userId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void updateAckConfig(AckConfig config) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_ack_config(_uniffiHandle, + FfiConverterTypeAckConfig.INSTANCE.lower(config), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void updateDedupConfig(DedupConfig config) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dedup_config(_uniffiHandle, + FfiConverterTypeDedupConfig.INSTANCE.lower(config), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void updateDorsConfig(DorsConfig config) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dors_config(_uniffiHandle, + FfiConverterTypeDorsConfig.INSTANCE.lower(config), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void updateRelayConfig(RelayConfig config) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_relay_config(_uniffiHandle, + FfiConverterTypeRelayConfig.INSTANCE.lower(config), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void updateRetryConfig(RetryConfig config) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_retry_config(_uniffiHandle, + FfiConverterTypeRetryConfig.INSTANCE.lower(config), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void updateTransportMetrics(TransportType transportType, TransportMetrics metrics) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_transport_metrics(_uniffiHandle, + FfiConverterTypeTransportType.INSTANCE.lower(transportType), FfiConverterTypeTransportMetrics.INSTANCE.lower(metrics), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean verifySignature(java.util.List publicKey, java.util.List data, java.util.List signature) throws ProtocolException { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature(_uniffiHandle, + FfiConverterSequenceByte.INSTANCE.lower(publicKey), FfiConverterSequenceByte.INSTANCE.lower(data), FfiConverterSequenceByte.INSTANCE.lower(signature), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public boolean verifySignatureBytes(byte[] publicKey, byte[] data, byte[] signature) throws ProtocolException { + try { + return FfiConverterBoolean.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature_bytes(_uniffiHandle, + FfiConverterByteArray.INSTANCE.lower(publicKey), FfiConverterByteArray.INSTANCE.lower(data), FfiConverterByteArray.INSTANCE.lower(signature), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public WifiDirectMessage wifiDirectGetNextMessage() { + try { + return FfiConverterOptionalTypeWifiDirectMessage.INSTANCE.lift( + callWithHandle(_uniffiHandle -> { + try { + + return + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_get_next_message(_allocator, _uniffiHandle, + _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void wifiDirectMessageReceived(java.lang.String senderId, java.util.List data) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_message_received(_uniffiHandle, + FfiConverterString.INSTANCE.lower(senderId), FfiConverterSequenceByte.INSTANCE.lower(data), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void wifiDirectPeerConnected(java.lang.String peerId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_connected(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void wifiDirectPeerDisconnected(java.lang.String peerId) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_disconnected(_uniffiHandle, + FfiConverterString.INSTANCE.lower(peerId), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + @Override + public void wifiDirectStatusChanged(boolean isConnected) throws ProtocolException { + try { + + callWithHandle(_uniffiHandle -> { + try { + + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + UniffiLib.uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_status_changed(_uniffiHandle, + FfiConverterBoolean.INSTANCE.lower(isConnected), _status); + }); + } catch (java.lang.RuntimeException _uniffi_ex) { + throw _uniffi_ex; + } catch (java.lang.Exception _uniffi_ex) { + throw new java.lang.RuntimeException(_uniffi_ex); + } + }) + ; + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + + + + + + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocolInterface.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocolInterface.java new file mode 100644 index 00000000..63cde660 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocolInterface.java @@ -0,0 +1,186 @@ +package com.offlineprotocol.sdk; + +public interface OfflineProtocolInterface { + public java.lang.String acceptConnectionRequest(java.lang.String recipient, java.lang.String accepterName, java.util.List keyPackage) throws ProtocolException; + public void bleClearPeerMtu(java.lang.String peerId) throws ProtocolException; + public long bleFragmentFallbackCount(); + public void bleFragmentReceived(java.lang.String senderId, java.util.List fragment) throws ProtocolException; + public BleFragment bleGetNextFragment(); + public int bleGetPeerCount(); + public void blePeerDiscovered(java.lang.String peerId, short rssi) throws ProtocolException; + public void blePeerLost(java.lang.String peerId) throws ProtocolException; + public long bleRecipientNotAmongPeersCount(); + public void bleReturnFragment(); + public void bleSetPeerMtu(java.lang.String peerId, int maxPayload) throws ProtocolException; + public void bleStatusChanged(boolean isAvailable) throws ProtocolException; + public long bleUndersizedMtuReports(); + public void blockUser(java.lang.String userId) throws ProtocolException; + public java.lang.String cancelConnectionRequest(java.lang.String recipient) throws ProtocolException; + public void cancelFileTransfer(java.lang.String fileId) throws ProtocolException; + public void closeFileStores() throws ProtocolException; + public MlsGroupInfo createGroup(java.lang.String groupName) throws ProtocolException; + public java.lang.String createInvite(java.lang.String petname, boolean sign) throws ProtocolException; + public java.lang.String deriveUserIdFromPublicKey(java.util.List publicKey); + public void disableTelemetry() throws ProtocolException; + public void emitTestEvent(); + public void enableTelemetry(TelemetryConfig config, AppState appState) throws ProtocolException; + public void endTelemetrySession(); + public void eraseCustody() throws ProtocolException; + public MlsWelcomeMessage establishSecureSession(java.lang.String peerId) throws ProtocolException; + public void finalizeFile(java.lang.String fileId) throws ProtocolException; + public void flushTelemetry(); + public boolean flushTelemetryBlocking(long deadlineMs); + public void forceTransport(TransportType transportType) throws ProtocolException; + public java.lang.String forwardMessage(java.lang.String originalMessageJson, java.lang.String newRecipient, MessagePriority priority) throws ProtocolException; + public java.util.List forwardMessageToGroup(java.lang.String originalMessageJson, java.lang.String groupId, MessagePriority priority) throws ProtocolException; + public GatewayAddressDeclaration gatewayAddressDeclaration(java.util.List challenge) throws ProtocolException; + public java.util.List getActiveTransports(); + public java.lang.Byte getBatteryLevel(); + public java.util.List getBlockedUsers() throws ProtocolException; + public CustodyStats getCustodyStats(); + public DedupStats getDedupStats(); + public float getDeliverySuccessRate(); + public DorsConfig getDorsConfig(); + public EstablishmentState getEstablishmentState(java.lang.String peerId) throws ProtocolException; + public FileProgress getFileProgress(java.lang.String fileId); + public MlsGroupInfo getGroupInfo(java.lang.String groupId) throws ProtocolException; + public java.util.Map getGroupRoles(java.lang.String groupId) throws ProtocolException; + public java.util.List getIdentityPublicKey() throws ProtocolException; + public boolean getIsCharging(); + public byte getMedianHops(); + public long getMedianLatency(); + public java.lang.String getMemberRole(java.lang.String groupId, java.lang.String userId) throws ProtocolException; + public MeshRelayStats getMeshRelayStats(); + public MeshRelayTunables getMeshRelayTunables(); + public java.util.List getMessageStats(); + public long getPendingAckCount(); + public RelayConfig getRelayConfig(); + public RelayPriority getRelayPriority(); + public long getRetryQueueSize(); + public ProtocolState getState(); + public NetworkTopology getTopology() throws ProtocolException; + public TransportMetrics getTransportMetrics(TransportType transportType); + public RelaySyncState groupRelaySyncState(java.lang.String groupId) throws ProtocolException; + public GroupRichReadiness groupRichReadiness(java.lang.String groupId) throws ProtocolException; + public boolean hasPendingKeyPackage(java.lang.String peerId); + public java.util.List identityAssertion(java.util.List signedData) throws ProtocolException; + public void initializeMls(MlsStorageProvider secureStorage, ProtocolStateStorageProvider protocolStateStorage) throws ProtocolException; + public void initializeMlsWithFileStores(java.lang.String mlsRoot, java.lang.String stateRoot, byte[] storeKey) throws ProtocolException; + public void internetAddressDeclarationRefused(java.lang.String reason); + public void internetAddressDeclared(java.lang.String address); + public void internetConfirmSent(java.lang.String messageId); + public InternetMessage internetGetNextMessage(); + public void internetGroupReportReceived(java.lang.String reportJson) throws ProtocolException; + public void internetMessageReceived(java.lang.String senderId, java.util.List data) throws ProtocolException; + public void internetPeerPresence(java.lang.String peerId, boolean online, java.lang.Long lastSeenMs); + public java.util.List internetPresenceWatchlist(); + public void internetRelayCapabilities(java.util.List capabilities) throws ProtocolException; + public void internetSendFailed(java.lang.String messageId); + public void internetSendFailedWithReason(java.lang.String messageId, java.lang.String reason); + public void internetStatusChanged(boolean isConnected) throws ProtocolException; + public void inviteToGroup(java.lang.String groupId, java.lang.String inviteeUserId) throws ProtocolException; + public boolean isMlsInitialized(); + public boolean isRelay(); + public boolean isUserBlocked(java.lang.String userId) throws ProtocolException; + public void leaveGroup(java.lang.String groupId) throws ProtocolException; + public java.util.List listGroups() throws ProtocolException; + public java.lang.String localAddress(); + public void mlsClearPendingWelcome(java.lang.String otherUserId) throws ProtocolException; + public MlsWelcomeMessage mlsCreateSession(java.lang.String otherUserId) throws ProtocolException; + public java.util.List mlsDecrypt(MlsEncryptedMessage encrypted) throws ProtocolException; + public java.util.List mlsDecryptFromUser(MlsEncryptedMessage encrypted) throws ProtocolException; + public void mlsDeleteSession(java.lang.String otherUserId) throws ProtocolException; + public MlsEncryptedMessage mlsEncryptForUser(java.lang.String otherUserId, java.util.List plaintext) throws ProtocolException; + public MlsKeyPackageBundle mlsGenerateKeyPackage() throws ProtocolException; + public MlsKeyPackageBundle mlsGetOrCreateKeyPackage() throws ProtocolException; + public java.util.List mlsGetPendingKeyPackages(); + public MlsWelcomeMessage mlsGetPendingWelcome(java.lang.String otherUserId); + public boolean mlsHasSession(java.lang.String otherUserId); + public void mlsImportKeyPackage(java.lang.String userId, java.util.List keyPackageData) throws ProtocolException; + public MlsGroupInfo mlsJoinSession(MlsWelcomeMessage welcome) throws ProtocolException; + public java.util.List mlsListSessions(); + public void mlsMarkKeyPackageSynced(java.lang.String packageId) throws ProtocolException; + public MlsGroupInfo mlsProcessWelcome(MlsWelcomeMessage welcome) throws ProtocolException; + public void nostrConfirmSent(java.lang.String messageId); + public NostrMessage nostrGetNextMessage(); + public NostrQuery nostrGetNextQuery(); + public java.lang.String nostrGetPublicKey(); + public java.lang.String nostrGetSubscriptionFilter(java.lang.String subscriptionId); + public void nostrMessageReceived(java.lang.String senderId, java.util.List data) throws ProtocolException; + public void nostrMessageReceivedAt(java.lang.String senderId, java.util.List data, long createdAt) throws ProtocolException; + public void nostrQueryCompleted(java.lang.String queryId); + public void nostrQueryEventReceived(java.lang.String queryId, java.lang.String eventJson) throws ProtocolException; + public void nostrSendFailed(java.lang.String messageId); + public void nostrSendFailedWithReason(java.lang.String messageId, java.lang.String reason); + public void nostrStatusChanged(boolean isConnected) throws ProtocolException; + public void notifyAppState(AppState state); + public void pause() throws ProtocolException; + public java.lang.String pollEvent(); + public void process() throws ProtocolException; + public void processFileChunk(java.lang.String fileId, int chunkIndex, int totalChunks, long fileSize, java.lang.String fileName, java.lang.String fileChecksum, java.util.List data) throws ProtocolException; + public ProtocolLockDiagnostics protocolLockDiagnostics(); + public java.lang.String receiveMessage(); + public java.lang.String rejectConnectionRequest(java.lang.String recipient) throws ProtocolException; + public boolean rekeySession(java.lang.String peerId) throws ProtocolException; + public void releaseTransportLock(); + public void removeFromGroup(java.lang.String groupId, java.lang.String memberId) throws ProtocolException; + public void removeTransport(TransportType transportType) throws ProtocolException; + public void renameGroup(java.lang.String groupId, java.lang.String newName) throws ProtocolException; + public boolean requestGroupRelayRegistration(java.lang.String groupId) throws ProtocolException; + public boolean resolveUsername(java.lang.String username) throws ProtocolException; + public void resume() throws ProtocolException; + public void reticulumAddressDeclarationRefused(java.lang.String reason); + public void reticulumAddressDeclared(java.lang.String address); + public void reticulumConfirmSent(java.lang.String messageId); + public void reticulumGatewayCapabilities(java.util.List capabilities) throws ProtocolException; + public ReticulumMessage reticulumGetNextMessage(); + public void reticulumMessageReceived(java.lang.String senderId, java.util.List data) throws ProtocolException; + public void reticulumPeerPresence(java.lang.String peerId, boolean online, java.lang.Long lastSeenMs); + public java.util.List reticulumPresenceWatchlist(); + public void reticulumSendFailed(java.lang.String messageId); + public void reticulumSendFailedWithReason(java.lang.String messageId, java.lang.String reason); + public void reticulumStatusChanged(boolean isConnected) throws ProtocolException; + public java.lang.String sendConnectionRequest(java.lang.String recipient, java.lang.String senderName, java.util.List keyPackage, java.lang.String initialMessage) throws ProtocolException; + public java.lang.String sendFile(java.lang.String recipient, java.util.List fileData, java.lang.String fileName) throws ProtocolException; + public java.util.List sendGroupMessage(java.lang.String groupId, java.lang.String content, MessagePriority priority, java.lang.String replyToMsg) throws ProtocolException; + public java.lang.String sendMedia(java.lang.String recipient, java.util.List fileData, java.lang.String fileName, ContentType contentType, MediaMetadata mediaMetadata) throws ProtocolException; + public java.lang.String sendMediaRich(java.lang.String recipient, java.util.List fileData, java.lang.String fileName, ContentType contentType, MediaSendOptions options) throws ProtocolException; + public java.lang.String sendMessage(java.lang.String recipient, java.lang.String content, MessagePriority priority, java.lang.String replyToMsg) throws ProtocolException; + public java.lang.String sendMessageRich(java.lang.String recipient, java.lang.String content, SendMessageOptions options) throws ProtocolException; + public java.lang.String sendPresenceUpdate(java.lang.String recipient, PresenceStatus status) throws ProtocolException; + public java.lang.String sendReadReceipt(java.lang.String recipient, java.util.List messageIds) throws ProtocolException; + public java.lang.String sendTypingIndicator(java.lang.String recipient, java.lang.String conversationId, boolean isTyping) throws ProtocolException; + public void setBatteryLevel(byte level) throws ProtocolException; + public void setBatteryState(byte level, boolean isCharging) throws ProtocolException; + public void setBleTransportCallback(BleTransportCallback callback); + public void setEventCallback(EventCallback callback); + public void setMemberRole(java.lang.String groupId, java.lang.String userId, java.lang.String role) throws ProtocolException; + public void setNostrTransportCallback(NostrTransportCallback callback); + public void setRelayPriority(RelayPriority priority) throws ProtocolException; + public void setReticulumTransportCallback(ReticulumTransportCallback callback); + public void setTelemetryEnabled(boolean enabled); + public void setWifiDirectTransportCallback(WifiDirectTransportCallback callback); + public boolean shouldEscalateToWifi(); + public java.util.List signData(java.util.List data) throws ProtocolException; + public byte[] signDataBytes(byte[] data) throws ProtocolException; + public void start() throws ProtocolException; + public void stop() throws ProtocolException; + public java.lang.String telemetryInstallId(); + public TelemetryStats telemetryStats(); + public void unblockUser(java.lang.String userId) throws ProtocolException; + public void updateAckConfig(AckConfig config) throws ProtocolException; + public void updateDedupConfig(DedupConfig config) throws ProtocolException; + public void updateDorsConfig(DorsConfig config) throws ProtocolException; + public void updateRelayConfig(RelayConfig config) throws ProtocolException; + public void updateRetryConfig(RetryConfig config) throws ProtocolException; + public void updateTransportMetrics(TransportType transportType, TransportMetrics metrics) throws ProtocolException; + public boolean verifySignature(java.util.List publicKey, java.util.List data, java.util.List signature) throws ProtocolException; + public boolean verifySignatureBytes(byte[] publicKey, byte[] data, byte[] signature) throws ProtocolException; + public WifiDirectMessage wifiDirectGetNextMessage(); + public void wifiDirectMessageReceived(java.lang.String senderId, java.util.List data) throws ProtocolException; + public void wifiDirectPeerConnected(java.lang.String peerId) throws ProtocolException; + public void wifiDirectPeerDisconnected(java.lang.String peerId) throws ProtocolException; + public void wifiDirectStatusChanged(boolean isConnected) throws ProtocolException; + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocolLib.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocolLib.java new file mode 100644 index 00000000..27ea86df --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/OfflineProtocolLib.java @@ -0,0 +1,94 @@ +package com.offlineprotocol.sdk; + + +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +public class OfflineProtocolLib { + public static java.lang.String deriveAddress(java.util.List publicKey) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_func_derive_address(_allocator, + FfiConverterSequenceByte.INSTANCE.lower(publicKey), _status); + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + public static InviteInfo parseInvite(java.lang.String blob) throws ProtocolException { + try { + return FfiConverterTypeInviteInfo.INSTANCE.lift( + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_func_parse_invite(_allocator, + FfiConverterString.INSTANCE.lower(blob), _status); + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + public static java.lang.String runStorageConformance(ProtocolStateStorageProvider storage) { + try { + return FfiConverterString.INSTANCE.lift( + UniffiHelpers.uniffiRustCall( (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_func_run_storage_conformance(_allocator, + FfiConverterTypeProtocolStateStorageProvider.INSTANCE.lower(storage), _status); + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + + public static java.lang.String verifyIdentityAssertion(java.util.List assertion) throws ProtocolException { + try { + return FfiConverterString.INSTANCE.lift( + UniffiHelpers.uniffiRustCallWithError(new ProtocolExceptionErrorHandler(), (_allocator, _status) -> { + return UniffiLib.uniffi_offline_protocol_uniffi_fn_func_verify_identity_assertion(_allocator, + FfiConverterSequenceByte.INSTANCE.lower(assertion), _status); + }) + ); + } catch (java.lang.RuntimeException _uniffi_ex) { + + if (ProtocolException.class.isInstance(_uniffi_ex.getCause())) { + throw (ProtocolException)_uniffi_ex.getCause(); + } + + if (InternalException.class.isInstance(_uniffi_ex.getCause())) { + throw (InternalException)_uniffi_ex.getCause(); + } + throw _uniffi_ex; + } + } + + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/OverflowPolicy.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/OverflowPolicy.java new file mode 100644 index 00000000..d7f7ed14 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/OverflowPolicy.java @@ -0,0 +1,15 @@ +package com.offlineprotocol.sdk; + + + +public enum OverflowPolicy { + DROP_OLDEST, + DROP_NEWEST; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/PeerDevice.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/PeerDevice.java new file mode 100644 index 00000000..47f7cc23 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/PeerDevice.java @@ -0,0 +1,75 @@ +package com.offlineprotocol.sdk; + +public class PeerDevice { + private java.lang.String peerId; + private short rssi; + private long lastSeenMs; + + public PeerDevice( + java.lang.String peerId, + short rssi, + long lastSeenMs + ) { + + this.peerId = peerId; + + this.rssi = rssi; + + this.lastSeenMs = lastSeenMs; + } + + public java.lang.String peerId() { + return this.peerId; + } + + public short rssi() { + return this.rssi; + } + + public long lastSeenMs() { + return this.lastSeenMs; + } + public void setPeerId(java.lang.String peerId) { + this.peerId = peerId; + } + public void setRssi(short rssi) { + this.rssi = rssi; + } + public void setLastSeenMs(long lastSeenMs) { + this.lastSeenMs = lastSeenMs; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof PeerDevice) { + PeerDevice _uniffiThat = (PeerDevice) _uniffiOther; + return ( + java.util.Objects.equals(peerId, _uniffiThat.peerId) && + + rssi == _uniffiThat.rssi && + + lastSeenMs == _uniffiThat.lastSeenMs + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(peerId); + _uniffiHash = 31 * _uniffiHash + java.lang.Short.hashCode(rssi); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(lastSeenMs); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/PendingQueueConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/PendingQueueConfig.java new file mode 100644 index 00000000..b950a19b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/PendingQueueConfig.java @@ -0,0 +1,89 @@ +package com.offlineprotocol.sdk; + +public class PendingQueueConfig { + private long maxPendingPerPeer; + private long maxPendingGlobal; + private long pendingTtlMs; + private OverflowPolicy overflowPolicy; + + public PendingQueueConfig( + long maxPendingPerPeer, + long maxPendingGlobal, + long pendingTtlMs, + OverflowPolicy overflowPolicy + ) { + + this.maxPendingPerPeer = maxPendingPerPeer; + + this.maxPendingGlobal = maxPendingGlobal; + + this.pendingTtlMs = pendingTtlMs; + + this.overflowPolicy = overflowPolicy; + } + + public long maxPendingPerPeer() { + return this.maxPendingPerPeer; + } + + public long maxPendingGlobal() { + return this.maxPendingGlobal; + } + + public long pendingTtlMs() { + return this.pendingTtlMs; + } + + public OverflowPolicy overflowPolicy() { + return this.overflowPolicy; + } + public void setMaxPendingPerPeer(long maxPendingPerPeer) { + this.maxPendingPerPeer = maxPendingPerPeer; + } + public void setMaxPendingGlobal(long maxPendingGlobal) { + this.maxPendingGlobal = maxPendingGlobal; + } + public void setPendingTtlMs(long pendingTtlMs) { + this.pendingTtlMs = pendingTtlMs; + } + public void setOverflowPolicy(OverflowPolicy overflowPolicy) { + this.overflowPolicy = overflowPolicy; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof PendingQueueConfig) { + PendingQueueConfig _uniffiThat = (PendingQueueConfig) _uniffiOther; + return ( + maxPendingPerPeer == _uniffiThat.maxPendingPerPeer && + + maxPendingGlobal == _uniffiThat.maxPendingGlobal && + + pendingTtlMs == _uniffiThat.pendingTtlMs && + + java.util.Objects.equals(overflowPolicy, _uniffiThat.overflowPolicy) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(maxPendingPerPeer); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(maxPendingGlobal); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(pendingTtlMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(overflowPolicy); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/PresenceStatus.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/PresenceStatus.java new file mode 100644 index 00000000..845fef96 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/PresenceStatus.java @@ -0,0 +1,16 @@ +package com.offlineprotocol.sdk; + + + +public enum PresenceStatus { + ONLINE, + AWAY, + OFFLINE; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolConfig.java new file mode 100644 index 00000000..b2ed2c0d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolConfig.java @@ -0,0 +1,523 @@ +package com.offlineprotocol.sdk; + +public class ProtocolConfig { + private java.lang.String appId; + private java.lang.String profile; + private boolean bleEnabled; + private boolean wifiDirectEnabled; + private boolean internetEnabled; + private boolean reticulumEnabled; + private boolean nostrEnabled; + private boolean preferOnline; + private byte initialTtl; + private boolean encryptionEnabled; + private boolean autoKeyExchange; + private boolean storePending; + private boolean requireEncryption; + private long maxPendingPerPeer; + private long maxPendingGlobal; + private long pendingTtlMs; + private OverflowPolicy overflowPolicy; + private boolean edgeDrivenUnreachableDm; + private int maxGroupMembers; + private boolean groupRelayEnabled; + private boolean groupRelayBroadcastEnabled; + private boolean groupEnforceAdminCommits; + private boolean requireTransportIdentity; + private boolean binaryWireEnabled; + private boolean nostrSealingEnabled; + private boolean nostrColdContactEnabled; + private boolean nostrUsernameDiscoveryEnabled; + private boolean compactEnvelopeEnabled; + private boolean richPayloadEnabled; + private boolean cryptoRecoveryEnabled; + private MeshRelayConfig meshRelay; + private CustodyConfig custody; + private boolean dataEnabled; + private boolean controlFreshnessEnforced; + private boolean encryptServiceMessages; + + public ProtocolConfig( + java.lang.String appId, + java.lang.String profile, + boolean bleEnabled, + boolean wifiDirectEnabled, + boolean internetEnabled, + boolean reticulumEnabled, + boolean nostrEnabled, + boolean preferOnline, + byte initialTtl, + boolean encryptionEnabled, + boolean autoKeyExchange, + boolean storePending, + boolean requireEncryption, + long maxPendingPerPeer, + long maxPendingGlobal, + long pendingTtlMs, + OverflowPolicy overflowPolicy, + boolean edgeDrivenUnreachableDm, + int maxGroupMembers, + boolean groupRelayEnabled, + boolean groupRelayBroadcastEnabled, + boolean groupEnforceAdminCommits, + boolean requireTransportIdentity, + boolean binaryWireEnabled, + boolean nostrSealingEnabled, + boolean nostrColdContactEnabled, + boolean nostrUsernameDiscoveryEnabled, + boolean compactEnvelopeEnabled, + boolean richPayloadEnabled, + boolean cryptoRecoveryEnabled, + MeshRelayConfig meshRelay, + CustodyConfig custody, + boolean dataEnabled, + boolean controlFreshnessEnforced, + boolean encryptServiceMessages + ) { + + this.appId = appId; + + this.profile = profile; + + this.bleEnabled = bleEnabled; + + this.wifiDirectEnabled = wifiDirectEnabled; + + this.internetEnabled = internetEnabled; + + this.reticulumEnabled = reticulumEnabled; + + this.nostrEnabled = nostrEnabled; + + this.preferOnline = preferOnline; + + this.initialTtl = initialTtl; + + this.encryptionEnabled = encryptionEnabled; + + this.autoKeyExchange = autoKeyExchange; + + this.storePending = storePending; + + this.requireEncryption = requireEncryption; + + this.maxPendingPerPeer = maxPendingPerPeer; + + this.maxPendingGlobal = maxPendingGlobal; + + this.pendingTtlMs = pendingTtlMs; + + this.overflowPolicy = overflowPolicy; + + this.edgeDrivenUnreachableDm = edgeDrivenUnreachableDm; + + this.maxGroupMembers = maxGroupMembers; + + this.groupRelayEnabled = groupRelayEnabled; + + this.groupRelayBroadcastEnabled = groupRelayBroadcastEnabled; + + this.groupEnforceAdminCommits = groupEnforceAdminCommits; + + this.requireTransportIdentity = requireTransportIdentity; + + this.binaryWireEnabled = binaryWireEnabled; + + this.nostrSealingEnabled = nostrSealingEnabled; + + this.nostrColdContactEnabled = nostrColdContactEnabled; + + this.nostrUsernameDiscoveryEnabled = nostrUsernameDiscoveryEnabled; + + this.compactEnvelopeEnabled = compactEnvelopeEnabled; + + this.richPayloadEnabled = richPayloadEnabled; + + this.cryptoRecoveryEnabled = cryptoRecoveryEnabled; + + this.meshRelay = meshRelay; + + this.custody = custody; + + this.dataEnabled = dataEnabled; + + this.controlFreshnessEnforced = controlFreshnessEnforced; + + this.encryptServiceMessages = encryptServiceMessages; + } + + public java.lang.String appId() { + return this.appId; + } + + public java.lang.String profile() { + return this.profile; + } + + public boolean bleEnabled() { + return this.bleEnabled; + } + + public boolean wifiDirectEnabled() { + return this.wifiDirectEnabled; + } + + public boolean internetEnabled() { + return this.internetEnabled; + } + + public boolean reticulumEnabled() { + return this.reticulumEnabled; + } + + public boolean nostrEnabled() { + return this.nostrEnabled; + } + + public boolean preferOnline() { + return this.preferOnline; + } + + public byte initialTtl() { + return this.initialTtl; + } + + public boolean encryptionEnabled() { + return this.encryptionEnabled; + } + + public boolean autoKeyExchange() { + return this.autoKeyExchange; + } + + public boolean storePending() { + return this.storePending; + } + + public boolean requireEncryption() { + return this.requireEncryption; + } + + public long maxPendingPerPeer() { + return this.maxPendingPerPeer; + } + + public long maxPendingGlobal() { + return this.maxPendingGlobal; + } + + public long pendingTtlMs() { + return this.pendingTtlMs; + } + + public OverflowPolicy overflowPolicy() { + return this.overflowPolicy; + } + + public boolean edgeDrivenUnreachableDm() { + return this.edgeDrivenUnreachableDm; + } + + public int maxGroupMembers() { + return this.maxGroupMembers; + } + + public boolean groupRelayEnabled() { + return this.groupRelayEnabled; + } + + public boolean groupRelayBroadcastEnabled() { + return this.groupRelayBroadcastEnabled; + } + + public boolean groupEnforceAdminCommits() { + return this.groupEnforceAdminCommits; + } + + public boolean requireTransportIdentity() { + return this.requireTransportIdentity; + } + + public boolean binaryWireEnabled() { + return this.binaryWireEnabled; + } + + public boolean nostrSealingEnabled() { + return this.nostrSealingEnabled; + } + + public boolean nostrColdContactEnabled() { + return this.nostrColdContactEnabled; + } + + public boolean nostrUsernameDiscoveryEnabled() { + return this.nostrUsernameDiscoveryEnabled; + } + + public boolean compactEnvelopeEnabled() { + return this.compactEnvelopeEnabled; + } + + public boolean richPayloadEnabled() { + return this.richPayloadEnabled; + } + + public boolean cryptoRecoveryEnabled() { + return this.cryptoRecoveryEnabled; + } + + public MeshRelayConfig meshRelay() { + return this.meshRelay; + } + + public CustodyConfig custody() { + return this.custody; + } + + public boolean dataEnabled() { + return this.dataEnabled; + } + + public boolean controlFreshnessEnforced() { + return this.controlFreshnessEnforced; + } + + public boolean encryptServiceMessages() { + return this.encryptServiceMessages; + } + public void setAppId(java.lang.String appId) { + this.appId = appId; + } + public void setProfile(java.lang.String profile) { + this.profile = profile; + } + public void setBleEnabled(boolean bleEnabled) { + this.bleEnabled = bleEnabled; + } + public void setWifiDirectEnabled(boolean wifiDirectEnabled) { + this.wifiDirectEnabled = wifiDirectEnabled; + } + public void setInternetEnabled(boolean internetEnabled) { + this.internetEnabled = internetEnabled; + } + public void setReticulumEnabled(boolean reticulumEnabled) { + this.reticulumEnabled = reticulumEnabled; + } + public void setNostrEnabled(boolean nostrEnabled) { + this.nostrEnabled = nostrEnabled; + } + public void setPreferOnline(boolean preferOnline) { + this.preferOnline = preferOnline; + } + public void setInitialTtl(byte initialTtl) { + this.initialTtl = initialTtl; + } + public void setEncryptionEnabled(boolean encryptionEnabled) { + this.encryptionEnabled = encryptionEnabled; + } + public void setAutoKeyExchange(boolean autoKeyExchange) { + this.autoKeyExchange = autoKeyExchange; + } + public void setStorePending(boolean storePending) { + this.storePending = storePending; + } + public void setRequireEncryption(boolean requireEncryption) { + this.requireEncryption = requireEncryption; + } + public void setMaxPendingPerPeer(long maxPendingPerPeer) { + this.maxPendingPerPeer = maxPendingPerPeer; + } + public void setMaxPendingGlobal(long maxPendingGlobal) { + this.maxPendingGlobal = maxPendingGlobal; + } + public void setPendingTtlMs(long pendingTtlMs) { + this.pendingTtlMs = pendingTtlMs; + } + public void setOverflowPolicy(OverflowPolicy overflowPolicy) { + this.overflowPolicy = overflowPolicy; + } + public void setEdgeDrivenUnreachableDm(boolean edgeDrivenUnreachableDm) { + this.edgeDrivenUnreachableDm = edgeDrivenUnreachableDm; + } + public void setMaxGroupMembers(int maxGroupMembers) { + this.maxGroupMembers = maxGroupMembers; + } + public void setGroupRelayEnabled(boolean groupRelayEnabled) { + this.groupRelayEnabled = groupRelayEnabled; + } + public void setGroupRelayBroadcastEnabled(boolean groupRelayBroadcastEnabled) { + this.groupRelayBroadcastEnabled = groupRelayBroadcastEnabled; + } + public void setGroupEnforceAdminCommits(boolean groupEnforceAdminCommits) { + this.groupEnforceAdminCommits = groupEnforceAdminCommits; + } + public void setRequireTransportIdentity(boolean requireTransportIdentity) { + this.requireTransportIdentity = requireTransportIdentity; + } + public void setBinaryWireEnabled(boolean binaryWireEnabled) { + this.binaryWireEnabled = binaryWireEnabled; + } + public void setNostrSealingEnabled(boolean nostrSealingEnabled) { + this.nostrSealingEnabled = nostrSealingEnabled; + } + public void setNostrColdContactEnabled(boolean nostrColdContactEnabled) { + this.nostrColdContactEnabled = nostrColdContactEnabled; + } + public void setNostrUsernameDiscoveryEnabled(boolean nostrUsernameDiscoveryEnabled) { + this.nostrUsernameDiscoveryEnabled = nostrUsernameDiscoveryEnabled; + } + public void setCompactEnvelopeEnabled(boolean compactEnvelopeEnabled) { + this.compactEnvelopeEnabled = compactEnvelopeEnabled; + } + public void setRichPayloadEnabled(boolean richPayloadEnabled) { + this.richPayloadEnabled = richPayloadEnabled; + } + public void setCryptoRecoveryEnabled(boolean cryptoRecoveryEnabled) { + this.cryptoRecoveryEnabled = cryptoRecoveryEnabled; + } + public void setMeshRelay(MeshRelayConfig meshRelay) { + this.meshRelay = meshRelay; + } + public void setCustody(CustodyConfig custody) { + this.custody = custody; + } + public void setDataEnabled(boolean dataEnabled) { + this.dataEnabled = dataEnabled; + } + public void setControlFreshnessEnforced(boolean controlFreshnessEnforced) { + this.controlFreshnessEnforced = controlFreshnessEnforced; + } + public void setEncryptServiceMessages(boolean encryptServiceMessages) { + this.encryptServiceMessages = encryptServiceMessages; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof ProtocolConfig) { + ProtocolConfig _uniffiThat = (ProtocolConfig) _uniffiOther; + return ( + java.util.Objects.equals(appId, _uniffiThat.appId) && + + java.util.Objects.equals(profile, _uniffiThat.profile) && + + bleEnabled == _uniffiThat.bleEnabled && + + wifiDirectEnabled == _uniffiThat.wifiDirectEnabled && + + internetEnabled == _uniffiThat.internetEnabled && + + reticulumEnabled == _uniffiThat.reticulumEnabled && + + nostrEnabled == _uniffiThat.nostrEnabled && + + preferOnline == _uniffiThat.preferOnline && + + initialTtl == _uniffiThat.initialTtl && + + encryptionEnabled == _uniffiThat.encryptionEnabled && + + autoKeyExchange == _uniffiThat.autoKeyExchange && + + storePending == _uniffiThat.storePending && + + requireEncryption == _uniffiThat.requireEncryption && + + maxPendingPerPeer == _uniffiThat.maxPendingPerPeer && + + maxPendingGlobal == _uniffiThat.maxPendingGlobal && + + pendingTtlMs == _uniffiThat.pendingTtlMs && + + java.util.Objects.equals(overflowPolicy, _uniffiThat.overflowPolicy) && + + edgeDrivenUnreachableDm == _uniffiThat.edgeDrivenUnreachableDm && + + maxGroupMembers == _uniffiThat.maxGroupMembers && + + groupRelayEnabled == _uniffiThat.groupRelayEnabled && + + groupRelayBroadcastEnabled == _uniffiThat.groupRelayBroadcastEnabled && + + groupEnforceAdminCommits == _uniffiThat.groupEnforceAdminCommits && + + requireTransportIdentity == _uniffiThat.requireTransportIdentity && + + binaryWireEnabled == _uniffiThat.binaryWireEnabled && + + nostrSealingEnabled == _uniffiThat.nostrSealingEnabled && + + nostrColdContactEnabled == _uniffiThat.nostrColdContactEnabled && + + nostrUsernameDiscoveryEnabled == _uniffiThat.nostrUsernameDiscoveryEnabled && + + compactEnvelopeEnabled == _uniffiThat.compactEnvelopeEnabled && + + richPayloadEnabled == _uniffiThat.richPayloadEnabled && + + cryptoRecoveryEnabled == _uniffiThat.cryptoRecoveryEnabled && + + java.util.Objects.equals(meshRelay, _uniffiThat.meshRelay) && + + java.util.Objects.equals(custody, _uniffiThat.custody) && + + dataEnabled == _uniffiThat.dataEnabled && + + controlFreshnessEnforced == _uniffiThat.controlFreshnessEnforced && + + encryptServiceMessages == _uniffiThat.encryptServiceMessages + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(appId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(profile); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(bleEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(wifiDirectEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(internetEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(reticulumEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(nostrEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(preferOnline); + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(initialTtl); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(encryptionEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(autoKeyExchange); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(storePending); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(requireEncryption); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(maxPendingPerPeer); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(maxPendingGlobal); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(pendingTtlMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(overflowPolicy); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(edgeDrivenUnreachableDm); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(maxGroupMembers); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(groupRelayEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(groupRelayBroadcastEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(groupEnforceAdminCommits); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(requireTransportIdentity); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(binaryWireEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(nostrSealingEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(nostrColdContactEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(nostrUsernameDiscoveryEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(compactEnvelopeEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(richPayloadEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(cryptoRecoveryEnabled); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(meshRelay); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(custody); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(dataEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(controlFreshnessEnforced); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(encryptServiceMessages); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolException.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolException.java new file mode 100644 index 00000000..ca9dff8a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolException.java @@ -0,0 +1,137 @@ +package com.offlineprotocol.sdk; + + + +public class ProtocolException extends java.lang.Exception { + private ProtocolException(java.lang.String message) { + super(message); + } + + public static class NotStarted extends ProtocolException { + public NotStarted(java.lang.String message) { + super(message); + } + } + public static class AlreadyStarted extends ProtocolException { + public AlreadyStarted(java.lang.String message) { + super(message); + } + } + public static class InvalidConfiguration extends ProtocolException { + public InvalidConfiguration(java.lang.String message) { + super(message); + } + } + public static class SendFailed extends ProtocolException { + public SendFailed(java.lang.String message) { + super(message); + } + } + public static class NoKeyPackage extends ProtocolException { + public NoKeyPackage(java.lang.String message) { + super(message); + } + } + public static class SessionNotReady extends ProtocolException { + public SessionNotReady(java.lang.String message) { + super(message); + } + } + public static class EncryptFailed extends ProtocolException { + public EncryptFailed(java.lang.String message) { + super(message); + } + } + public static class InvalidState extends ProtocolException { + public InvalidState(java.lang.String message) { + super(message); + } + } + public static class MlsNotInitialized extends ProtocolException { + public MlsNotInitialized(java.lang.String message) { + super(message); + } + } + public static class MlsException extends ProtocolException { + public MlsException(java.lang.String message) { + super(message); + } + } + public static class UserBlocked extends ProtocolException { + public UserBlocked(java.lang.String message) { + super(message); + } + } + public static class MediaTransferLimit extends ProtocolException { + public MediaTransferLimit(java.lang.String message) { + super(message); + } + } + public static class LockPoisoned extends ProtocolException { + public LockPoisoned(java.lang.String message) { + super(message); + } + } + public static class Other extends ProtocolException { + public Other(java.lang.String message) { + super(message); + } + } + public static class TransportException extends ProtocolException { + public TransportException(java.lang.String message) { + super(message); + } + } + public static class SerializationException extends ProtocolException { + public SerializationException(java.lang.String message) { + super(message); + } + } + public static class ServiceException extends ProtocolException { + public ServiceException(java.lang.String message) { + super(message); + } + } + public static class GroupNotFound extends ProtocolException { + public GroupNotFound(java.lang.String message) { + super(message); + } + } + public static class PermissionDenied extends ProtocolException { + public PermissionDenied(java.lang.String message) { + super(message); + } + } + public static class InvalidArgument extends ProtocolException { + public InvalidArgument(java.lang.String message) { + super(message); + } + } + public static class DataDisabled extends ProtocolException { + public DataDisabled(java.lang.String message) { + super(message); + } + } + public static class DataStorageUnavailable extends ProtocolException { + public DataStorageUnavailable(java.lang.String message) { + super(message); + } + } + public static class DocTooLarge extends ProtocolException { + public DocTooLarge(java.lang.String message) { + super(message); + } + } + public static class DataCorrupted extends ProtocolException { + public DataCorrupted(java.lang.String message) { + super(message); + } + } + public static class TelemetryConfigInvalid extends ProtocolException { + public TelemetryConfigInvalid(java.lang.String message) { + super(message); + } + } + +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolExceptionErrorHandler.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolExceptionErrorHandler.java new file mode 100644 index 00000000..363dd2aa --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolExceptionErrorHandler.java @@ -0,0 +1,10 @@ +package com.offlineprotocol.sdk; + + +public class ProtocolExceptionErrorHandler implements UniffiRustCallStatusErrorHandler { + @Override + public ProtocolException lift(java.lang.foreign.MemorySegment errorBuf){ + return FfiConverterTypeProtocolError.INSTANCE.lift(errorBuf); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolLockDiagnostics.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolLockDiagnostics.java new file mode 100644 index 00000000..032d7ea4 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolLockDiagnostics.java @@ -0,0 +1,89 @@ +package com.offlineprotocol.sdk; + +public class ProtocolLockDiagnostics { + private boolean held; + private java.lang.String holderLocation; + private java.lang.String holderThread; + private long heldForMs; + + public ProtocolLockDiagnostics( + boolean held, + java.lang.String holderLocation, + java.lang.String holderThread, + long heldForMs + ) { + + this.held = held; + + this.holderLocation = holderLocation; + + this.holderThread = holderThread; + + this.heldForMs = heldForMs; + } + + public boolean held() { + return this.held; + } + + public java.lang.String holderLocation() { + return this.holderLocation; + } + + public java.lang.String holderThread() { + return this.holderThread; + } + + public long heldForMs() { + return this.heldForMs; + } + public void setHeld(boolean held) { + this.held = held; + } + public void setHolderLocation(java.lang.String holderLocation) { + this.holderLocation = holderLocation; + } + public void setHolderThread(java.lang.String holderThread) { + this.holderThread = holderThread; + } + public void setHeldForMs(long heldForMs) { + this.heldForMs = heldForMs; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof ProtocolLockDiagnostics) { + ProtocolLockDiagnostics _uniffiThat = (ProtocolLockDiagnostics) _uniffiOther; + return ( + held == _uniffiThat.held && + + java.util.Objects.equals(holderLocation, _uniffiThat.holderLocation) && + + java.util.Objects.equals(holderThread, _uniffiThat.holderThread) && + + heldForMs == _uniffiThat.heldForMs + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(held); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(holderLocation); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(holderThread); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(heldForMs); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolState.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolState.java new file mode 100644 index 00000000..54bc717e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolState.java @@ -0,0 +1,16 @@ +package com.offlineprotocol.sdk; + + + +public enum ProtocolState { + STOPPED, + RUNNING, + PAUSED; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolStateStorageProvider.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolStateStorageProvider.java new file mode 100644 index 00000000..e93ad062 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ProtocolStateStorageProvider.java @@ -0,0 +1,9 @@ +package com.offlineprotocol.sdk; + +public interface ProtocolStateStorageProvider { + public void store(java.lang.String keyType, java.lang.String keyId, byte[] data) throws MlsStorageException; + public byte[] load(java.lang.String keyType, java.lang.String keyId) throws MlsStorageException; + public void delete(java.lang.String keyType, java.lang.String keyId) throws MlsStorageException; + public java.util.List listKeys(java.lang.String keyType) throws MlsStorageException; + +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/RelayConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/RelayConfig.java new file mode 100644 index 00000000..42191571 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/RelayConfig.java @@ -0,0 +1,75 @@ +package com.offlineprotocol.sdk; + +public class RelayConfig { + private byte minBatteryForRelay; + private boolean allowRelay; + private RelayPriority relayPriority; + + public RelayConfig( + byte minBatteryForRelay, + boolean allowRelay, + RelayPriority relayPriority + ) { + + this.minBatteryForRelay = minBatteryForRelay; + + this.allowRelay = allowRelay; + + this.relayPriority = relayPriority; + } + + public byte minBatteryForRelay() { + return this.minBatteryForRelay; + } + + public boolean allowRelay() { + return this.allowRelay; + } + + public RelayPriority relayPriority() { + return this.relayPriority; + } + public void setMinBatteryForRelay(byte minBatteryForRelay) { + this.minBatteryForRelay = minBatteryForRelay; + } + public void setAllowRelay(boolean allowRelay) { + this.allowRelay = allowRelay; + } + public void setRelayPriority(RelayPriority relayPriority) { + this.relayPriority = relayPriority; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof RelayConfig) { + RelayConfig _uniffiThat = (RelayConfig) _uniffiOther; + return ( + minBatteryForRelay == _uniffiThat.minBatteryForRelay && + + allowRelay == _uniffiThat.allowRelay && + + java.util.Objects.equals(relayPriority, _uniffiThat.relayPriority) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Byte.hashCode(minBatteryForRelay); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(allowRelay); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(relayPriority); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/RelayPriority.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/RelayPriority.java new file mode 100644 index 00000000..34810919 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/RelayPriority.java @@ -0,0 +1,16 @@ +package com.offlineprotocol.sdk; + + + +public enum RelayPriority { + NEVER, + AUTO, + ALWAYS; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/RelaySyncState.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/RelaySyncState.java new file mode 100644 index 00000000..abd96126 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/RelaySyncState.java @@ -0,0 +1,16 @@ +package com.offlineprotocol.sdk; + + + +public enum RelaySyncState { + SYNCED, + PENDING, + UNSYNCED; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ReliabilityConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ReliabilityConfig.java new file mode 100644 index 00000000..69a22957 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ReliabilityConfig.java @@ -0,0 +1,75 @@ +package com.offlineprotocol.sdk; + +public class ReliabilityConfig { + private AckConfig ack; + private RetryConfig retry; + private DedupConfig dedup; + + public ReliabilityConfig( + AckConfig ack, + RetryConfig retry, + DedupConfig dedup + ) { + + this.ack = ack; + + this.retry = retry; + + this.dedup = dedup; + } + + public AckConfig ack() { + return this.ack; + } + + public RetryConfig retry() { + return this.retry; + } + + public DedupConfig dedup() { + return this.dedup; + } + public void setAck(AckConfig ack) { + this.ack = ack; + } + public void setRetry(RetryConfig retry) { + this.retry = retry; + } + public void setDedup(DedupConfig dedup) { + this.dedup = dedup; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof ReliabilityConfig) { + ReliabilityConfig _uniffiThat = (ReliabilityConfig) _uniffiOther; + return ( + java.util.Objects.equals(ack, _uniffiThat.ack) && + + java.util.Objects.equals(retry, _uniffiThat.retry) && + + java.util.Objects.equals(dedup, _uniffiThat.dedup) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(ack); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(retry); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(dedup); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ReplyContext.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ReplyContext.java new file mode 100644 index 00000000..db99c1e1 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ReplyContext.java @@ -0,0 +1,103 @@ +package com.offlineprotocol.sdk; + +public class ReplyContext { + private java.lang.String sender; + private java.lang.String text; + private java.lang.Long timestamp; + private java.lang.String replyMediaLabel; + private java.lang.String replyContentType; + + public ReplyContext( + java.lang.String sender, + java.lang.String text, + java.lang.Long timestamp, + java.lang.String replyMediaLabel, + java.lang.String replyContentType + ) { + + this.sender = sender; + + this.text = text; + + this.timestamp = timestamp; + + this.replyMediaLabel = replyMediaLabel; + + this.replyContentType = replyContentType; + } + + public java.lang.String sender() { + return this.sender; + } + + public java.lang.String text() { + return this.text; + } + + public java.lang.Long timestamp() { + return this.timestamp; + } + + public java.lang.String replyMediaLabel() { + return this.replyMediaLabel; + } + + public java.lang.String replyContentType() { + return this.replyContentType; + } + public void setSender(java.lang.String sender) { + this.sender = sender; + } + public void setText(java.lang.String text) { + this.text = text; + } + public void setTimestamp(java.lang.Long timestamp) { + this.timestamp = timestamp; + } + public void setReplyMediaLabel(java.lang.String replyMediaLabel) { + this.replyMediaLabel = replyMediaLabel; + } + public void setReplyContentType(java.lang.String replyContentType) { + this.replyContentType = replyContentType; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof ReplyContext) { + ReplyContext _uniffiThat = (ReplyContext) _uniffiOther; + return ( + java.util.Objects.equals(sender, _uniffiThat.sender) && + + java.util.Objects.equals(text, _uniffiThat.text) && + + java.util.Objects.equals(timestamp, _uniffiThat.timestamp) && + + java.util.Objects.equals(replyMediaLabel, _uniffiThat.replyMediaLabel) && + + java.util.Objects.equals(replyContentType, _uniffiThat.replyContentType) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(sender); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(text); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(timestamp); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(replyMediaLabel); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(replyContentType); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ReticulumMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ReticulumMessage.java new file mode 100644 index 00000000..6fffec3e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ReticulumMessage.java @@ -0,0 +1,89 @@ +package com.offlineprotocol.sdk; + +public class ReticulumMessage { + private java.lang.String messageId; + private java.lang.String recipientId; + private java.util.List data; + private java.lang.String replyToMsg; + + public ReticulumMessage( + java.lang.String messageId, + java.lang.String recipientId, + java.util.List data, + java.lang.String replyToMsg + ) { + + this.messageId = messageId; + + this.recipientId = recipientId; + + this.data = data; + + this.replyToMsg = replyToMsg; + } + + public java.lang.String messageId() { + return this.messageId; + } + + public java.lang.String recipientId() { + return this.recipientId; + } + + public java.util.List data() { + return this.data; + } + + public java.lang.String replyToMsg() { + return this.replyToMsg; + } + public void setMessageId(java.lang.String messageId) { + this.messageId = messageId; + } + public void setRecipientId(java.lang.String recipientId) { + this.recipientId = recipientId; + } + public void setData(java.util.List data) { + this.data = data; + } + public void setReplyToMsg(java.lang.String replyToMsg) { + this.replyToMsg = replyToMsg; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof ReticulumMessage) { + ReticulumMessage _uniffiThat = (ReticulumMessage) _uniffiOther; + return ( + java.util.Objects.equals(messageId, _uniffiThat.messageId) && + + java.util.Objects.equals(recipientId, _uniffiThat.recipientId) && + + java.util.Objects.equals(data, _uniffiThat.data) && + + java.util.Objects.equals(replyToMsg, _uniffiThat.replyToMsg) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(messageId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(recipientId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(data); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(replyToMsg); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/ReticulumTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/ReticulumTransportCallback.java new file mode 100644 index 00000000..2a181544 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/ReticulumTransportCallback.java @@ -0,0 +1,6 @@ +package com.offlineprotocol.sdk; + +public interface ReticulumTransportCallback { + public void onMessagesAvailable(); + +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/RetryConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/RetryConfig.java new file mode 100644 index 00000000..72b35220 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/RetryConfig.java @@ -0,0 +1,131 @@ +package com.offlineprotocol.sdk; + +public class RetryConfig { + private int maxRetries; + private long initialDelayMs; + private long maxDelayMs; + private float backoffMultiplier; + private long outboxMaxLifetimeMs; + private long pendingMessageMaxLifetimeMs; + private boolean edgeDrivenUnreachableDm; + + public RetryConfig( + int maxRetries, + long initialDelayMs, + long maxDelayMs, + float backoffMultiplier, + long outboxMaxLifetimeMs, + long pendingMessageMaxLifetimeMs, + boolean edgeDrivenUnreachableDm + ) { + + this.maxRetries = maxRetries; + + this.initialDelayMs = initialDelayMs; + + this.maxDelayMs = maxDelayMs; + + this.backoffMultiplier = backoffMultiplier; + + this.outboxMaxLifetimeMs = outboxMaxLifetimeMs; + + this.pendingMessageMaxLifetimeMs = pendingMessageMaxLifetimeMs; + + this.edgeDrivenUnreachableDm = edgeDrivenUnreachableDm; + } + + public int maxRetries() { + return this.maxRetries; + } + + public long initialDelayMs() { + return this.initialDelayMs; + } + + public long maxDelayMs() { + return this.maxDelayMs; + } + + public float backoffMultiplier() { + return this.backoffMultiplier; + } + + public long outboxMaxLifetimeMs() { + return this.outboxMaxLifetimeMs; + } + + public long pendingMessageMaxLifetimeMs() { + return this.pendingMessageMaxLifetimeMs; + } + + public boolean edgeDrivenUnreachableDm() { + return this.edgeDrivenUnreachableDm; + } + public void setMaxRetries(int maxRetries) { + this.maxRetries = maxRetries; + } + public void setInitialDelayMs(long initialDelayMs) { + this.initialDelayMs = initialDelayMs; + } + public void setMaxDelayMs(long maxDelayMs) { + this.maxDelayMs = maxDelayMs; + } + public void setBackoffMultiplier(float backoffMultiplier) { + this.backoffMultiplier = backoffMultiplier; + } + public void setOutboxMaxLifetimeMs(long outboxMaxLifetimeMs) { + this.outboxMaxLifetimeMs = outboxMaxLifetimeMs; + } + public void setPendingMessageMaxLifetimeMs(long pendingMessageMaxLifetimeMs) { + this.pendingMessageMaxLifetimeMs = pendingMessageMaxLifetimeMs; + } + public void setEdgeDrivenUnreachableDm(boolean edgeDrivenUnreachableDm) { + this.edgeDrivenUnreachableDm = edgeDrivenUnreachableDm; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof RetryConfig) { + RetryConfig _uniffiThat = (RetryConfig) _uniffiOther; + return ( + maxRetries == _uniffiThat.maxRetries && + + initialDelayMs == _uniffiThat.initialDelayMs && + + maxDelayMs == _uniffiThat.maxDelayMs && + + java.lang.Float.compare(backoffMultiplier, _uniffiThat.backoffMultiplier) == 0 && + + outboxMaxLifetimeMs == _uniffiThat.outboxMaxLifetimeMs && + + pendingMessageMaxLifetimeMs == _uniffiThat.pendingMessageMaxLifetimeMs && + + edgeDrivenUnreachableDm == _uniffiThat.edgeDrivenUnreachableDm + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(maxRetries); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(initialDelayMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(maxDelayMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(backoffMultiplier); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(outboxMaxLifetimeMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(pendingMessageMaxLifetimeMs); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(edgeDrivenUnreachableDm); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/RustBuffer.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/RustBuffer.java new file mode 100644 index 00000000..adead338 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/RustBuffer.java @@ -0,0 +1,85 @@ +package com.offlineprotocol.sdk; + + +/** + * This is a helper for safely working with byte buffers returned from the Rust code. + * A rust-owned buffer is represented by its capacity, its current length, and a + * pointer to the underlying data. + */ +public final class RustBuffer { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_LONG.withName("capacity"), + java.lang.foreign.ValueLayout.JAVA_LONG.withName("len"), + java.lang.foreign.ValueLayout.ADDRESS.withName("data") + ); + + private static final long OFFSET_CAPACITY = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("capacity")); + private static final long OFFSET_LEN = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("len")); + private static final long OFFSET_DATA = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("data")); + + private RustBuffer() {} + + public static long getCapacity(java.lang.foreign.MemorySegment seg) { + return seg.get(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_CAPACITY); + } + + public static void setCapacity(java.lang.foreign.MemorySegment seg, long value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_CAPACITY, value); + } + + public static long getLen(java.lang.foreign.MemorySegment seg) { + return seg.get(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_LEN); + } + + public static void setLen(java.lang.foreign.MemorySegment seg, long value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_LEN, value); + } + + public static java.lang.foreign.MemorySegment getData(java.lang.foreign.MemorySegment seg) { + return seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_DATA); + } + + public static void setData(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_DATA, value); + } + + public static java.lang.foreign.MemorySegment alloc(long size) { + java.lang.foreign.MemorySegment buffer = UniffiHelpers.uniffiRustCall((_allocator, status) -> { + return UniffiLib.ffi_offline_protocol_uniffi_rustbuffer_alloc(_allocator, size, status); + }); + if (getData(buffer).equals(java.lang.foreign.MemorySegment.NULL) && size > 0) { + throw new java.lang.RuntimeException("RustBuffer.alloc() returned null data pointer (size=" + size + ")"); + } + return buffer; + } + + public static void free(java.lang.foreign.MemorySegment buffer) { + UniffiHelpers.uniffiRustCall((_allocator, status) -> { + UniffiLib.ffi_offline_protocol_uniffi_rustbuffer_free(buffer, status); + return null; + }); + } + + /** + * Get a ByteBuffer view of the data for reading (len bytes). + */ + public static java.nio.ByteBuffer asByteBuffer(java.lang.foreign.MemorySegment seg) { + long len = getLen(seg); + if (len == 0) { + return java.nio.ByteBuffer.allocate(0).order(java.nio.ByteOrder.BIG_ENDIAN); + } + return getData(seg).reinterpret(len).asByteBuffer().order(java.nio.ByteOrder.BIG_ENDIAN); + } + + /** + * Get a ByteBuffer view of the data for writing (capacity bytes). + */ + public static java.nio.ByteBuffer asWriteByteBuffer(java.lang.foreign.MemorySegment seg) { + long capacity = getCapacity(seg); + if (capacity == 0) { + return java.nio.ByteBuffer.allocate(0).order(java.nio.ByteOrder.BIG_ENDIAN); + } + return getData(seg).reinterpret(capacity).asByteBuffer().order(java.nio.ByteOrder.BIG_ENDIAN); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/SendMessageOptions.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/SendMessageOptions.java new file mode 100644 index 00000000..8c8538e6 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/SendMessageOptions.java @@ -0,0 +1,131 @@ +package com.offlineprotocol.sdk; + +public class SendMessageOptions { + private MessagePriority priority; + private java.lang.String replyToMsg; + private ContentType contentType; + private ReplyContext replyContext; + private MediaMetadata mediaMetadata; + private ForwardInfo forwardInfo; + private java.lang.String appId; + + public SendMessageOptions( + MessagePriority priority, + java.lang.String replyToMsg, + ContentType contentType, + ReplyContext replyContext, + MediaMetadata mediaMetadata, + ForwardInfo forwardInfo, + java.lang.String appId + ) { + + this.priority = priority; + + this.replyToMsg = replyToMsg; + + this.contentType = contentType; + + this.replyContext = replyContext; + + this.mediaMetadata = mediaMetadata; + + this.forwardInfo = forwardInfo; + + this.appId = appId; + } + + public MessagePriority priority() { + return this.priority; + } + + public java.lang.String replyToMsg() { + return this.replyToMsg; + } + + public ContentType contentType() { + return this.contentType; + } + + public ReplyContext replyContext() { + return this.replyContext; + } + + public MediaMetadata mediaMetadata() { + return this.mediaMetadata; + } + + public ForwardInfo forwardInfo() { + return this.forwardInfo; + } + + public java.lang.String appId() { + return this.appId; + } + public void setPriority(MessagePriority priority) { + this.priority = priority; + } + public void setReplyToMsg(java.lang.String replyToMsg) { + this.replyToMsg = replyToMsg; + } + public void setContentType(ContentType contentType) { + this.contentType = contentType; + } + public void setReplyContext(ReplyContext replyContext) { + this.replyContext = replyContext; + } + public void setMediaMetadata(MediaMetadata mediaMetadata) { + this.mediaMetadata = mediaMetadata; + } + public void setForwardInfo(ForwardInfo forwardInfo) { + this.forwardInfo = forwardInfo; + } + public void setAppId(java.lang.String appId) { + this.appId = appId; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof SendMessageOptions) { + SendMessageOptions _uniffiThat = (SendMessageOptions) _uniffiOther; + return ( + java.util.Objects.equals(priority, _uniffiThat.priority) && + + java.util.Objects.equals(replyToMsg, _uniffiThat.replyToMsg) && + + java.util.Objects.equals(contentType, _uniffiThat.contentType) && + + java.util.Objects.equals(replyContext, _uniffiThat.replyContext) && + + java.util.Objects.equals(mediaMetadata, _uniffiThat.mediaMetadata) && + + java.util.Objects.equals(forwardInfo, _uniffiThat.forwardInfo) && + + java.util.Objects.equals(appId, _uniffiThat.appId) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(priority); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(replyToMsg); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(contentType); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(replyContext); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(mediaMetadata); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(forwardInfo); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(appId); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryConfig.java new file mode 100644 index 00000000..8410c69d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryConfig.java @@ -0,0 +1,243 @@ +package com.offlineprotocol.sdk; + +public class TelemetryConfig { + private java.lang.String apiKey; + private java.lang.String appId; + private TelemetryOs os; + private short osMajor; + private java.lang.String appVersion; + private java.lang.Boolean debug; + private java.lang.Long flushIntervalMs; + private java.lang.Long maxBatchBytes; + private java.lang.Integer maxBufferedRecords; + private java.lang.Boolean includeDeviceId; + private java.lang.Boolean scrubIds; + private MlsVerbosity mlsVerbosity; + private java.lang.Long metricsCadenceMs; + private java.lang.Boolean routingDiagnostic; + private java.lang.Boolean mlsSamplingBypass; + + public TelemetryConfig( + java.lang.String apiKey, + java.lang.String appId, + TelemetryOs os, + short osMajor, + java.lang.String appVersion, + java.lang.Boolean debug, + java.lang.Long flushIntervalMs, + java.lang.Long maxBatchBytes, + java.lang.Integer maxBufferedRecords, + java.lang.Boolean includeDeviceId, + java.lang.Boolean scrubIds, + MlsVerbosity mlsVerbosity, + java.lang.Long metricsCadenceMs, + java.lang.Boolean routingDiagnostic, + java.lang.Boolean mlsSamplingBypass + ) { + + this.apiKey = apiKey; + + this.appId = appId; + + this.os = os; + + this.osMajor = osMajor; + + this.appVersion = appVersion; + + this.debug = debug; + + this.flushIntervalMs = flushIntervalMs; + + this.maxBatchBytes = maxBatchBytes; + + this.maxBufferedRecords = maxBufferedRecords; + + this.includeDeviceId = includeDeviceId; + + this.scrubIds = scrubIds; + + this.mlsVerbosity = mlsVerbosity; + + this.metricsCadenceMs = metricsCadenceMs; + + this.routingDiagnostic = routingDiagnostic; + + this.mlsSamplingBypass = mlsSamplingBypass; + } + + public java.lang.String apiKey() { + return this.apiKey; + } + + public java.lang.String appId() { + return this.appId; + } + + public TelemetryOs os() { + return this.os; + } + + public short osMajor() { + return this.osMajor; + } + + public java.lang.String appVersion() { + return this.appVersion; + } + + public java.lang.Boolean debug() { + return this.debug; + } + + public java.lang.Long flushIntervalMs() { + return this.flushIntervalMs; + } + + public java.lang.Long maxBatchBytes() { + return this.maxBatchBytes; + } + + public java.lang.Integer maxBufferedRecords() { + return this.maxBufferedRecords; + } + + public java.lang.Boolean includeDeviceId() { + return this.includeDeviceId; + } + + public java.lang.Boolean scrubIds() { + return this.scrubIds; + } + + public MlsVerbosity mlsVerbosity() { + return this.mlsVerbosity; + } + + public java.lang.Long metricsCadenceMs() { + return this.metricsCadenceMs; + } + + public java.lang.Boolean routingDiagnostic() { + return this.routingDiagnostic; + } + + public java.lang.Boolean mlsSamplingBypass() { + return this.mlsSamplingBypass; + } + public void setApiKey(java.lang.String apiKey) { + this.apiKey = apiKey; + } + public void setAppId(java.lang.String appId) { + this.appId = appId; + } + public void setOs(TelemetryOs os) { + this.os = os; + } + public void setOsMajor(short osMajor) { + this.osMajor = osMajor; + } + public void setAppVersion(java.lang.String appVersion) { + this.appVersion = appVersion; + } + public void setDebug(java.lang.Boolean debug) { + this.debug = debug; + } + public void setFlushIntervalMs(java.lang.Long flushIntervalMs) { + this.flushIntervalMs = flushIntervalMs; + } + public void setMaxBatchBytes(java.lang.Long maxBatchBytes) { + this.maxBatchBytes = maxBatchBytes; + } + public void setMaxBufferedRecords(java.lang.Integer maxBufferedRecords) { + this.maxBufferedRecords = maxBufferedRecords; + } + public void setIncludeDeviceId(java.lang.Boolean includeDeviceId) { + this.includeDeviceId = includeDeviceId; + } + public void setScrubIds(java.lang.Boolean scrubIds) { + this.scrubIds = scrubIds; + } + public void setMlsVerbosity(MlsVerbosity mlsVerbosity) { + this.mlsVerbosity = mlsVerbosity; + } + public void setMetricsCadenceMs(java.lang.Long metricsCadenceMs) { + this.metricsCadenceMs = metricsCadenceMs; + } + public void setRoutingDiagnostic(java.lang.Boolean routingDiagnostic) { + this.routingDiagnostic = routingDiagnostic; + } + public void setMlsSamplingBypass(java.lang.Boolean mlsSamplingBypass) { + this.mlsSamplingBypass = mlsSamplingBypass; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof TelemetryConfig) { + TelemetryConfig _uniffiThat = (TelemetryConfig) _uniffiOther; + return ( + java.util.Objects.equals(apiKey, _uniffiThat.apiKey) && + + java.util.Objects.equals(appId, _uniffiThat.appId) && + + java.util.Objects.equals(os, _uniffiThat.os) && + + osMajor == _uniffiThat.osMajor && + + java.util.Objects.equals(appVersion, _uniffiThat.appVersion) && + + java.util.Objects.equals(debug, _uniffiThat.debug) && + + java.util.Objects.equals(flushIntervalMs, _uniffiThat.flushIntervalMs) && + + java.util.Objects.equals(maxBatchBytes, _uniffiThat.maxBatchBytes) && + + java.util.Objects.equals(maxBufferedRecords, _uniffiThat.maxBufferedRecords) && + + java.util.Objects.equals(includeDeviceId, _uniffiThat.includeDeviceId) && + + java.util.Objects.equals(scrubIds, _uniffiThat.scrubIds) && + + java.util.Objects.equals(mlsVerbosity, _uniffiThat.mlsVerbosity) && + + java.util.Objects.equals(metricsCadenceMs, _uniffiThat.metricsCadenceMs) && + + java.util.Objects.equals(routingDiagnostic, _uniffiThat.routingDiagnostic) && + + java.util.Objects.equals(mlsSamplingBypass, _uniffiThat.mlsSamplingBypass) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(apiKey); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(appId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(os); + _uniffiHash = 31 * _uniffiHash + java.lang.Short.hashCode(osMajor); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(appVersion); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(debug); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(flushIntervalMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(maxBatchBytes); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(maxBufferedRecords); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(includeDeviceId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(scrubIds); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(mlsVerbosity); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(metricsCadenceMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(routingDiagnostic); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(mlsSamplingBypass); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryOs.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryOs.java new file mode 100644 index 00000000..77faf3a4 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryOs.java @@ -0,0 +1,19 @@ +package com.offlineprotocol.sdk; + + + +public enum TelemetryOs { + IOS, + ANDROID, + LINUX, + MACOS, + WINDOWS, + OTHER; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryStats.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryStats.java new file mode 100644 index 00000000..2133a97d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/TelemetryStats.java @@ -0,0 +1,131 @@ +package com.offlineprotocol.sdk; + +public class TelemetryStats { + private long buffered; + private long sentEvents; + private long acceptedEvents; + private long dropped; + private java.lang.String sessionId; + private java.lang.String lastError; + private java.lang.Long lastFlushAtMs; + + public TelemetryStats( + long buffered, + long sentEvents, + long acceptedEvents, + long dropped, + java.lang.String sessionId, + java.lang.String lastError, + java.lang.Long lastFlushAtMs + ) { + + this.buffered = buffered; + + this.sentEvents = sentEvents; + + this.acceptedEvents = acceptedEvents; + + this.dropped = dropped; + + this.sessionId = sessionId; + + this.lastError = lastError; + + this.lastFlushAtMs = lastFlushAtMs; + } + + public long buffered() { + return this.buffered; + } + + public long sentEvents() { + return this.sentEvents; + } + + public long acceptedEvents() { + return this.acceptedEvents; + } + + public long dropped() { + return this.dropped; + } + + public java.lang.String sessionId() { + return this.sessionId; + } + + public java.lang.String lastError() { + return this.lastError; + } + + public java.lang.Long lastFlushAtMs() { + return this.lastFlushAtMs; + } + public void setBuffered(long buffered) { + this.buffered = buffered; + } + public void setSentEvents(long sentEvents) { + this.sentEvents = sentEvents; + } + public void setAcceptedEvents(long acceptedEvents) { + this.acceptedEvents = acceptedEvents; + } + public void setDropped(long dropped) { + this.dropped = dropped; + } + public void setSessionId(java.lang.String sessionId) { + this.sessionId = sessionId; + } + public void setLastError(java.lang.String lastError) { + this.lastError = lastError; + } + public void setLastFlushAtMs(java.lang.Long lastFlushAtMs) { + this.lastFlushAtMs = lastFlushAtMs; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof TelemetryStats) { + TelemetryStats _uniffiThat = (TelemetryStats) _uniffiOther; + return ( + buffered == _uniffiThat.buffered && + + sentEvents == _uniffiThat.sentEvents && + + acceptedEvents == _uniffiThat.acceptedEvents && + + dropped == _uniffiThat.dropped && + + java.util.Objects.equals(sessionId, _uniffiThat.sessionId) && + + java.util.Objects.equals(lastError, _uniffiThat.lastError) && + + java.util.Objects.equals(lastFlushAtMs, _uniffiThat.lastFlushAtMs) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(buffered); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(sentEvents); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(acceptedEvents); + _uniffiHash = 31 * _uniffiHash + java.lang.Long.hashCode(dropped); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(sessionId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(lastError); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(lastFlushAtMs); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportConfig.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportConfig.java new file mode 100644 index 00000000..abbd1e5c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportConfig.java @@ -0,0 +1,145 @@ +package com.offlineprotocol.sdk; + +public class TransportConfig { + private boolean bleEnabled; + private boolean wifiDirectEnabled; + private boolean internetEnabled; + private boolean reticulumEnabled; + private boolean nostrEnabled; + private boolean nostrSealingEnabled; + private boolean nostrColdContactEnabled; + private boolean nostrUsernameDiscoveryEnabled; + + public TransportConfig( + boolean bleEnabled, + boolean wifiDirectEnabled, + boolean internetEnabled, + boolean reticulumEnabled, + boolean nostrEnabled, + boolean nostrSealingEnabled, + boolean nostrColdContactEnabled, + boolean nostrUsernameDiscoveryEnabled + ) { + + this.bleEnabled = bleEnabled; + + this.wifiDirectEnabled = wifiDirectEnabled; + + this.internetEnabled = internetEnabled; + + this.reticulumEnabled = reticulumEnabled; + + this.nostrEnabled = nostrEnabled; + + this.nostrSealingEnabled = nostrSealingEnabled; + + this.nostrColdContactEnabled = nostrColdContactEnabled; + + this.nostrUsernameDiscoveryEnabled = nostrUsernameDiscoveryEnabled; + } + + public boolean bleEnabled() { + return this.bleEnabled; + } + + public boolean wifiDirectEnabled() { + return this.wifiDirectEnabled; + } + + public boolean internetEnabled() { + return this.internetEnabled; + } + + public boolean reticulumEnabled() { + return this.reticulumEnabled; + } + + public boolean nostrEnabled() { + return this.nostrEnabled; + } + + public boolean nostrSealingEnabled() { + return this.nostrSealingEnabled; + } + + public boolean nostrColdContactEnabled() { + return this.nostrColdContactEnabled; + } + + public boolean nostrUsernameDiscoveryEnabled() { + return this.nostrUsernameDiscoveryEnabled; + } + public void setBleEnabled(boolean bleEnabled) { + this.bleEnabled = bleEnabled; + } + public void setWifiDirectEnabled(boolean wifiDirectEnabled) { + this.wifiDirectEnabled = wifiDirectEnabled; + } + public void setInternetEnabled(boolean internetEnabled) { + this.internetEnabled = internetEnabled; + } + public void setReticulumEnabled(boolean reticulumEnabled) { + this.reticulumEnabled = reticulumEnabled; + } + public void setNostrEnabled(boolean nostrEnabled) { + this.nostrEnabled = nostrEnabled; + } + public void setNostrSealingEnabled(boolean nostrSealingEnabled) { + this.nostrSealingEnabled = nostrSealingEnabled; + } + public void setNostrColdContactEnabled(boolean nostrColdContactEnabled) { + this.nostrColdContactEnabled = nostrColdContactEnabled; + } + public void setNostrUsernameDiscoveryEnabled(boolean nostrUsernameDiscoveryEnabled) { + this.nostrUsernameDiscoveryEnabled = nostrUsernameDiscoveryEnabled; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof TransportConfig) { + TransportConfig _uniffiThat = (TransportConfig) _uniffiOther; + return ( + bleEnabled == _uniffiThat.bleEnabled && + + wifiDirectEnabled == _uniffiThat.wifiDirectEnabled && + + internetEnabled == _uniffiThat.internetEnabled && + + reticulumEnabled == _uniffiThat.reticulumEnabled && + + nostrEnabled == _uniffiThat.nostrEnabled && + + nostrSealingEnabled == _uniffiThat.nostrSealingEnabled && + + nostrColdContactEnabled == _uniffiThat.nostrColdContactEnabled && + + nostrUsernameDiscoveryEnabled == _uniffiThat.nostrUsernameDiscoveryEnabled + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(bleEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(wifiDirectEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(internetEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(reticulumEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(nostrEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(nostrSealingEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(nostrColdContactEnabled); + _uniffiHash = 31 * _uniffiHash + java.lang.Boolean.hashCode(nostrUsernameDiscoveryEnabled); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportMetrics.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportMetrics.java new file mode 100644 index 00000000..29a16aff --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportMetrics.java @@ -0,0 +1,285 @@ +package com.offlineprotocol.sdk; + +public class TransportMetrics { + private int packetsSent; + private int packetsReceived; + private int bytesSent; + private int bytesReceived; + private float errorRate; + private int avgLatencyMs; + private java.lang.Short rssi; + private java.lang.Long bandwidthBps; + private java.lang.Float congestion; + private java.lang.Integer queueDepth; + private java.lang.Byte batteryLevel; + private java.lang.Boolean isCharging; + private java.lang.Byte relayConnectionCount; + private java.lang.Boolean isActiveRelay; + private java.lang.Float deliveryRatio; + private java.lang.Float dropRate; + private java.lang.Float averageHopCount; + private java.lang.Float energyCost; + + public TransportMetrics( + int packetsSent, + int packetsReceived, + int bytesSent, + int bytesReceived, + float errorRate, + int avgLatencyMs, + java.lang.Short rssi, + java.lang.Long bandwidthBps, + java.lang.Float congestion, + java.lang.Integer queueDepth, + java.lang.Byte batteryLevel, + java.lang.Boolean isCharging, + java.lang.Byte relayConnectionCount, + java.lang.Boolean isActiveRelay, + java.lang.Float deliveryRatio, + java.lang.Float dropRate, + java.lang.Float averageHopCount, + java.lang.Float energyCost + ) { + + this.packetsSent = packetsSent; + + this.packetsReceived = packetsReceived; + + this.bytesSent = bytesSent; + + this.bytesReceived = bytesReceived; + + this.errorRate = errorRate; + + this.avgLatencyMs = avgLatencyMs; + + this.rssi = rssi; + + this.bandwidthBps = bandwidthBps; + + this.congestion = congestion; + + this.queueDepth = queueDepth; + + this.batteryLevel = batteryLevel; + + this.isCharging = isCharging; + + this.relayConnectionCount = relayConnectionCount; + + this.isActiveRelay = isActiveRelay; + + this.deliveryRatio = deliveryRatio; + + this.dropRate = dropRate; + + this.averageHopCount = averageHopCount; + + this.energyCost = energyCost; + } + + public int packetsSent() { + return this.packetsSent; + } + + public int packetsReceived() { + return this.packetsReceived; + } + + public int bytesSent() { + return this.bytesSent; + } + + public int bytesReceived() { + return this.bytesReceived; + } + + public float errorRate() { + return this.errorRate; + } + + public int avgLatencyMs() { + return this.avgLatencyMs; + } + + public java.lang.Short rssi() { + return this.rssi; + } + + public java.lang.Long bandwidthBps() { + return this.bandwidthBps; + } + + public java.lang.Float congestion() { + return this.congestion; + } + + public java.lang.Integer queueDepth() { + return this.queueDepth; + } + + public java.lang.Byte batteryLevel() { + return this.batteryLevel; + } + + public java.lang.Boolean isCharging() { + return this.isCharging; + } + + public java.lang.Byte relayConnectionCount() { + return this.relayConnectionCount; + } + + public java.lang.Boolean isActiveRelay() { + return this.isActiveRelay; + } + + public java.lang.Float deliveryRatio() { + return this.deliveryRatio; + } + + public java.lang.Float dropRate() { + return this.dropRate; + } + + public java.lang.Float averageHopCount() { + return this.averageHopCount; + } + + public java.lang.Float energyCost() { + return this.energyCost; + } + public void setPacketsSent(int packetsSent) { + this.packetsSent = packetsSent; + } + public void setPacketsReceived(int packetsReceived) { + this.packetsReceived = packetsReceived; + } + public void setBytesSent(int bytesSent) { + this.bytesSent = bytesSent; + } + public void setBytesReceived(int bytesReceived) { + this.bytesReceived = bytesReceived; + } + public void setErrorRate(float errorRate) { + this.errorRate = errorRate; + } + public void setAvgLatencyMs(int avgLatencyMs) { + this.avgLatencyMs = avgLatencyMs; + } + public void setRssi(java.lang.Short rssi) { + this.rssi = rssi; + } + public void setBandwidthBps(java.lang.Long bandwidthBps) { + this.bandwidthBps = bandwidthBps; + } + public void setCongestion(java.lang.Float congestion) { + this.congestion = congestion; + } + public void setQueueDepth(java.lang.Integer queueDepth) { + this.queueDepth = queueDepth; + } + public void setBatteryLevel(java.lang.Byte batteryLevel) { + this.batteryLevel = batteryLevel; + } + public void setIsCharging(java.lang.Boolean isCharging) { + this.isCharging = isCharging; + } + public void setRelayConnectionCount(java.lang.Byte relayConnectionCount) { + this.relayConnectionCount = relayConnectionCount; + } + public void setIsActiveRelay(java.lang.Boolean isActiveRelay) { + this.isActiveRelay = isActiveRelay; + } + public void setDeliveryRatio(java.lang.Float deliveryRatio) { + this.deliveryRatio = deliveryRatio; + } + public void setDropRate(java.lang.Float dropRate) { + this.dropRate = dropRate; + } + public void setAverageHopCount(java.lang.Float averageHopCount) { + this.averageHopCount = averageHopCount; + } + public void setEnergyCost(java.lang.Float energyCost) { + this.energyCost = energyCost; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof TransportMetrics) { + TransportMetrics _uniffiThat = (TransportMetrics) _uniffiOther; + return ( + packetsSent == _uniffiThat.packetsSent && + + packetsReceived == _uniffiThat.packetsReceived && + + bytesSent == _uniffiThat.bytesSent && + + bytesReceived == _uniffiThat.bytesReceived && + + java.lang.Float.compare(errorRate, _uniffiThat.errorRate) == 0 && + + avgLatencyMs == _uniffiThat.avgLatencyMs && + + java.util.Objects.equals(rssi, _uniffiThat.rssi) && + + java.util.Objects.equals(bandwidthBps, _uniffiThat.bandwidthBps) && + + java.util.Objects.equals(congestion, _uniffiThat.congestion) && + + java.util.Objects.equals(queueDepth, _uniffiThat.queueDepth) && + + java.util.Objects.equals(batteryLevel, _uniffiThat.batteryLevel) && + + java.util.Objects.equals(isCharging, _uniffiThat.isCharging) && + + java.util.Objects.equals(relayConnectionCount, _uniffiThat.relayConnectionCount) && + + java.util.Objects.equals(isActiveRelay, _uniffiThat.isActiveRelay) && + + java.util.Objects.equals(deliveryRatio, _uniffiThat.deliveryRatio) && + + java.util.Objects.equals(dropRate, _uniffiThat.dropRate) && + + java.util.Objects.equals(averageHopCount, _uniffiThat.averageHopCount) && + + java.util.Objects.equals(energyCost, _uniffiThat.energyCost) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(packetsSent); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(packetsReceived); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(bytesSent); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(bytesReceived); + _uniffiHash = 31 * _uniffiHash + java.lang.Float.hashCode(errorRate); + _uniffiHash = 31 * _uniffiHash + java.lang.Integer.hashCode(avgLatencyMs); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(rssi); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(bandwidthBps); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(congestion); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(queueDepth); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(batteryLevel); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(isCharging); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(relayConnectionCount); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(isActiveRelay); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(deliveryRatio); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(dropRate); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(averageHopCount); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(energyCost); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportType.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportType.java new file mode 100644 index 00000000..0eb7b84e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/TransportType.java @@ -0,0 +1,18 @@ +package com.offlineprotocol.sdk; + + + +public enum TransportType { + INTERNET, + BLE, + WI_FI_DIRECT, + RETICULUM, + NOSTR; + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiBackpressureCleaner.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiBackpressureCleaner.java new file mode 100644 index 00000000..1e7d8b2b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiBackpressureCleaner.java @@ -0,0 +1,116 @@ +package com.offlineprotocol.sdk; + + +// A Cleaner backed by PhantomReference + ReferenceQueue with opportunistic inline draining. +// +// How it works: +// 1. Each registered object gets a PhantomReference pointing at a ReferenceQueue. +// A doubly-linked list keeps strong references to the PhantomRefs so they aren't +// GC'd before their referents. +// 2. A daemon thread blocks on queue.remove() and runs cleanup actions (steady state). +// 3. On every register() call, we do a small non-blocking drain of the queue on the +// calling thread. queue.poll() is ~nanoseconds when empty, so the overhead is +// negligible, but under sustained allocation pressure it provides continuous +// backpressure that prevents the cleanup backlog from growing unboundedly. +// 4. Explicit close()/clean() is idempotent - manual clean and GC-triggered clean +// race via a volatile CAS, so the action runs at most once. +// 5. clean() is idempotent via VarHandle CAS. It synchronizes on the list sentinel +// to unlink itself, preventing dead entries from accumulating. +class UniffiBackpressureCleaner implements UniffiCleaner { + private static final int DRAIN_BATCH_SIZE = 8; + + private final java.lang.ref.ReferenceQueue queue = new java.lang.ref.ReferenceQueue<>(); + // Sentinel node for the doubly-linked list. All list mutations synchronize on this. + private final CleanableRef head = new CleanableRef(); + + UniffiBackpressureCleaner() { + Thread t = new Thread(() -> { + while (true) { + try { + java.lang.ref.Reference ref = queue.remove(); + if (ref instanceof CleanableRef) { + ((CleanableRef) ref).clean(); + } + } catch (InterruptedException e) { + break; + } + } + }); + t.setDaemon(true); + t.setName("uniffi-cleaner"); + t.start(); + } + + @Override + public UniffiCleaner.Cleanable register(java.lang.Object value, java.lang.Runnable cleanUpTask) { + // Opportunistic drain: process a few pending refs on this thread. + // queue.poll() is essentially free when the queue is empty. + for (int i = 0; i < DRAIN_BATCH_SIZE; i++) { + java.lang.ref.Reference ref = queue.poll(); + if (ref == null) break; + if (ref instanceof CleanableRef) { + ((CleanableRef) ref).clean(); + } + } + return new CleanableRef(head, value, queue, cleanUpTask); + } + + // A PhantomReference that doubles as a Cleanable, stored in a doubly-linked list to + // keep it alive until cleanup. The cleanup action is stored in a volatile field with + // VarHandle CAS for idempotent clean(). clean() synchronizes on the list sentinel to + // unlink, keeping the list trimmed. + private static class CleanableRef extends java.lang.ref.PhantomReference implements UniffiCleaner.Cleanable { + private static final java.lang.invoke.VarHandle ACTION; + static { + try { + ACTION = java.lang.invoke.MethodHandles.lookup() + .findVarHandle(CleanableRef.class, "action", java.lang.Runnable.class); + } catch (ReflectiveOperationException e) { + throw new ExceptionInInitializerError(e); + } + } + + private volatile java.lang.Runnable action; + private final CleanableRef list; // sentinel to synchronize on + private CleanableRef prev; + private CleanableRef next; + + // Sentinel constructor. + CleanableRef() { + super(null, null); + this.list = this; + this.prev = this; + this.next = this; + } + + // Normal constructor - inserts itself into the list. + CleanableRef(CleanableRef list, java.lang.Object referent, java.lang.ref.ReferenceQueue q, java.lang.Runnable action) { + super(referent, q); + this.action = action; + this.list = list; + synchronized (list) { + this.prev = list; + this.next = list.next; + list.next.prev = this; + list.next = this; + } + } + + @Override + public void clean() { + // Atomic swap ensures the action runs at most once, even if called + // concurrently from close() and the background cleaner thread. + java.lang.Runnable a = (java.lang.Runnable) ACTION.getAndSet(this, null); + if (a != null) { + synchronized (list) { + // Because of the swap above this these guards shouldn't be necessary, but including them defensively + if (next != null) next.prev = prev; + if (prev != null) prev.next = next; + prev = null; + next = null; + } + a.run(); + } + } + } +} \ No newline at end of file diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceBleTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceBleTransportCallback.java new file mode 100644 index 00000000..d98125dd --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceBleTransportCallback.java @@ -0,0 +1,64 @@ +package com.offlineprotocol.sdk; + + +// Put the implementation in an object so we don't pollute the top-level namespace +public class UniffiCallbackInterfaceBleTransportCallback { + public static final UniffiCallbackInterfaceBleTransportCallback INSTANCE = new UniffiCallbackInterfaceBleTransportCallback(); + java.lang.foreign.MemorySegment vtable; + + UniffiCallbackInterfaceBleTransportCallback() { + // Use Arena.global() for vtable and upcall stubs - they live for the program lifetime. + // Arena.ofAuto() stubs can be GC'd since storing an address in a struct doesn't + // prevent the Arena from being collected. + vtable = java.lang.foreign.Arena.global().allocate(UniffiVTableCallbackInterfaceBleTransportCallback.LAYOUT); + UniffiVTableCallbackInterfaceBleTransportCallback.setuniffiFree(vtable, UniffiCallbackInterfaceFree.toUpcallStub(UniffiFree.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceBleTransportCallback.setuniffiClone(vtable, UniffiCallbackInterfaceClone.toUpcallStub(UniffiClone.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceBleTransportCallback.setonFragmentsAvailable(vtable, UniffiCallbackInterfaceBleTransportCallbackMethod0.toUpcallStub(OnFragmentsAvailableCallback.INSTANCE, java.lang.foreign.Arena.global())); + } + + // Registers the foreign callback with the Rust side. + void register() { + UniffiLib.uniffi_offline_protocol_uniffi_fn_init_callback_vtable_bletransportcallback(vtable); + } + + public static final class OnFragmentsAvailableCallback implements UniffiCallbackInterfaceBleTransportCallbackMethod0.Fn { + public static final OnFragmentsAvailableCallback INSTANCE = new OnFragmentsAvailableCallback(); + private OnFragmentsAvailableCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeBleTransportCallback.INSTANCE.handleMap.get(uniffiHandle); + java.util.function.Supplier _uniffiMakeCall = () -> { + _uniffiObj.onFragmentsAvailable( + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCall(_uniffiCallStatus, _uniffiMakeCall, _uniffiWriteReturn); + } + } + + public static class UniffiFree implements UniffiCallbackInterfaceFree.Fn { + public static final UniffiFree INSTANCE = new UniffiFree(); + + private UniffiFree() {} + + @Override + public void callback(long handle) { + FfiConverterTypeBleTransportCallback.INSTANCE.handleMap.remove(handle); + } + } + + public static class UniffiClone implements UniffiCallbackInterfaceClone.Fn { + public static final UniffiClone INSTANCE = new UniffiClone(); + + private UniffiClone() {} + + @Override + public long callback(long handle) { + return FfiConverterTypeBleTransportCallback.INSTANCE.handleMap.clone(handle); + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceBleTransportCallbackMethod0.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceBleTransportCallbackMethod0.java new file mode 100644 index 00000000..113d5ca5 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceBleTransportCallbackMethod0.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceBleTransportCallbackMethod0 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceClone.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceClone.java new file mode 100644 index 00000000..b6cdef24 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceClone.java @@ -0,0 +1,25 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceClone { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG); + + @FunctionalInterface + public interface Fn { + long callback(long handle); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + long.class, + long.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceEventCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceEventCallback.java new file mode 100644 index 00000000..864c7da7 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceEventCallback.java @@ -0,0 +1,65 @@ +package com.offlineprotocol.sdk; + + +// Put the implementation in an object so we don't pollute the top-level namespace +public class UniffiCallbackInterfaceEventCallback { + public static final UniffiCallbackInterfaceEventCallback INSTANCE = new UniffiCallbackInterfaceEventCallback(); + java.lang.foreign.MemorySegment vtable; + + UniffiCallbackInterfaceEventCallback() { + // Use Arena.global() for vtable and upcall stubs - they live for the program lifetime. + // Arena.ofAuto() stubs can be GC'd since storing an address in a struct doesn't + // prevent the Arena from being collected. + vtable = java.lang.foreign.Arena.global().allocate(UniffiVTableCallbackInterfaceEventCallback.LAYOUT); + UniffiVTableCallbackInterfaceEventCallback.setuniffiFree(vtable, UniffiCallbackInterfaceFree.toUpcallStub(UniffiFree.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceEventCallback.setuniffiClone(vtable, UniffiCallbackInterfaceClone.toUpcallStub(UniffiClone.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceEventCallback.setonEvent(vtable, UniffiCallbackInterfaceEventCallbackMethod0.toUpcallStub(OnEventCallback.INSTANCE, java.lang.foreign.Arena.global())); + } + + // Registers the foreign callback with the Rust side. + void register() { + UniffiLib.uniffi_offline_protocol_uniffi_fn_init_callback_vtable_eventcallback(vtable); + } + + public static final class OnEventCallback implements UniffiCallbackInterfaceEventCallbackMethod0.Fn { + public static final OnEventCallback INSTANCE = new OnEventCallback(); + private OnEventCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment eventJson,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeEventCallback.INSTANCE.handleMap.get(uniffiHandle); + java.util.function.Supplier _uniffiMakeCall = () -> { + _uniffiObj.onEvent( + FfiConverterString.INSTANCE.lift(eventJson) + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCall(_uniffiCallStatus, _uniffiMakeCall, _uniffiWriteReturn); + } + } + + public static class UniffiFree implements UniffiCallbackInterfaceFree.Fn { + public static final UniffiFree INSTANCE = new UniffiFree(); + + private UniffiFree() {} + + @Override + public void callback(long handle) { + FfiConverterTypeEventCallback.INSTANCE.handleMap.remove(handle); + } + } + + public static class UniffiClone implements UniffiCallbackInterfaceClone.Fn { + public static final UniffiClone INSTANCE = new UniffiClone(); + + private UniffiClone() {} + + @Override + public long callback(long handle) { + return FfiConverterTypeEventCallback.INSTANCE.handleMap.clone(handle); + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceEventCallbackMethod0.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceEventCallbackMethod0.java new file mode 100644 index 00000000..c1e36096 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceEventCallbackMethod0.java @@ -0,0 +1,29 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceEventCallbackMethod0 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment eventJson,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceFree.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceFree.java new file mode 100644 index 00000000..3f8b1f5e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceFree.java @@ -0,0 +1,25 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceFree { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG); + + @FunctionalInterface + public interface Fn { + void callback(long handle); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProvider.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProvider.java new file mode 100644 index 00000000..179fd284 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProvider.java @@ -0,0 +1,161 @@ +package com.offlineprotocol.sdk; + + +// Put the implementation in an object so we don't pollute the top-level namespace +public class UniffiCallbackInterfaceMlsStorageProvider { + public static final UniffiCallbackInterfaceMlsStorageProvider INSTANCE = new UniffiCallbackInterfaceMlsStorageProvider(); + java.lang.foreign.MemorySegment vtable; + + UniffiCallbackInterfaceMlsStorageProvider() { + // Use Arena.global() for vtable and upcall stubs - they live for the program lifetime. + // Arena.ofAuto() stubs can be GC'd since storing an address in a struct doesn't + // prevent the Arena from being collected. + vtable = java.lang.foreign.Arena.global().allocate(UniffiVTableCallbackInterfaceMlsStorageProvider.LAYOUT); + UniffiVTableCallbackInterfaceMlsStorageProvider.setuniffiFree(vtable, UniffiCallbackInterfaceFree.toUpcallStub(UniffiFree.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceMlsStorageProvider.setuniffiClone(vtable, UniffiCallbackInterfaceClone.toUpcallStub(UniffiClone.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceMlsStorageProvider.setstore(vtable, UniffiCallbackInterfaceMlsStorageProviderMethod0.toUpcallStub(StoreCallback.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceMlsStorageProvider.setload(vtable, UniffiCallbackInterfaceMlsStorageProviderMethod1.toUpcallStub(LoadCallback.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceMlsStorageProvider.setdelete(vtable, UniffiCallbackInterfaceMlsStorageProviderMethod2.toUpcallStub(DeleteCallback.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceMlsStorageProvider.setlistKeys(vtable, UniffiCallbackInterfaceMlsStorageProviderMethod3.toUpcallStub(ListKeysCallback.INSTANCE, java.lang.foreign.Arena.global())); + } + + // Registers the foreign callback with the Rust side. + void register() { + UniffiLib.uniffi_offline_protocol_uniffi_fn_init_callback_vtable_mlsstorageprovider(vtable); + } + + public static final class StoreCallback implements UniffiCallbackInterfaceMlsStorageProviderMethod0.Fn { + public static final StoreCallback INSTANCE = new StoreCallback(); + private StoreCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment data,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeMlsStorageProvider.INSTANCE.handleMap.get(uniffiHandle); + java.util.concurrent.Callable _uniffiMakeCall = () -> { + _uniffiObj.store( + FfiConverterString.INSTANCE.lift(keyType), + FfiConverterString.INSTANCE.lift(keyId), + FfiConverterSequenceByte.INSTANCE.lift(data) + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCallWithError( + _uniffiCallStatus, + _uniffiMakeCall, + _uniffiWriteReturn, + (MlsStorageException _uniffiErr) -> { return FfiConverterTypeMlsStorageError.INSTANCE.lower(_uniffiErr); }, + MlsStorageException.class + ); + } + } + + public static final class LoadCallback implements UniffiCallbackInterfaceMlsStorageProviderMethod1.Fn { + public static final LoadCallback INSTANCE = new LoadCallback(); + private LoadCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeMlsStorageProvider.INSTANCE.handleMap.get(uniffiHandle); + java.util.concurrent.Callable> _uniffiMakeCall = () -> { + return _uniffiObj.load( + FfiConverterString.INSTANCE.lift(keyType), + FfiConverterString.INSTANCE.lift(keyId) + ); + + }; + java.util.function.Consumer> _uniffiWriteReturn = (java.util.List _uniffiValue) -> { + java.lang.foreign.MemorySegment _uniffiOut = uniffiOutReturn.reinterpret(RustBuffer.LAYOUT.byteSize()); + java.lang.foreign.MemorySegment _uniffiLowered = FfiConverterOptionalSequenceByte.INSTANCE.lower(_uniffiValue); + java.lang.foreign.MemorySegment.copy(_uniffiLowered, 0, _uniffiOut, 0, RustBuffer.LAYOUT.byteSize()); + }; + UniffiHelpers.uniffiTraitInterfaceCallWithError( + _uniffiCallStatus, + _uniffiMakeCall, + _uniffiWriteReturn, + (MlsStorageException _uniffiErr) -> { return FfiConverterTypeMlsStorageError.INSTANCE.lower(_uniffiErr); }, + MlsStorageException.class + ); + } + } + + public static final class DeleteCallback implements UniffiCallbackInterfaceMlsStorageProviderMethod2.Fn { + public static final DeleteCallback INSTANCE = new DeleteCallback(); + private DeleteCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeMlsStorageProvider.INSTANCE.handleMap.get(uniffiHandle); + java.util.concurrent.Callable _uniffiMakeCall = () -> { + _uniffiObj.delete( + FfiConverterString.INSTANCE.lift(keyType), + FfiConverterString.INSTANCE.lift(keyId) + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCallWithError( + _uniffiCallStatus, + _uniffiMakeCall, + _uniffiWriteReturn, + (MlsStorageException _uniffiErr) -> { return FfiConverterTypeMlsStorageError.INSTANCE.lower(_uniffiErr); }, + MlsStorageException.class + ); + } + } + + public static final class ListKeysCallback implements UniffiCallbackInterfaceMlsStorageProviderMethod3.Fn { + public static final ListKeysCallback INSTANCE = new ListKeysCallback(); + private ListKeysCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeMlsStorageProvider.INSTANCE.handleMap.get(uniffiHandle); + java.util.concurrent.Callable> _uniffiMakeCall = () -> { + return _uniffiObj.listKeys( + FfiConverterString.INSTANCE.lift(keyType) + ); + + }; + java.util.function.Consumer> _uniffiWriteReturn = (java.util.List _uniffiValue) -> { + java.lang.foreign.MemorySegment _uniffiOut = uniffiOutReturn.reinterpret(RustBuffer.LAYOUT.byteSize()); + java.lang.foreign.MemorySegment _uniffiLowered = FfiConverterSequenceString.INSTANCE.lower(_uniffiValue); + java.lang.foreign.MemorySegment.copy(_uniffiLowered, 0, _uniffiOut, 0, RustBuffer.LAYOUT.byteSize()); + }; + UniffiHelpers.uniffiTraitInterfaceCallWithError( + _uniffiCallStatus, + _uniffiMakeCall, + _uniffiWriteReturn, + (MlsStorageException _uniffiErr) -> { return FfiConverterTypeMlsStorageError.INSTANCE.lower(_uniffiErr); }, + MlsStorageException.class + ); + } + } + + public static class UniffiFree implements UniffiCallbackInterfaceFree.Fn { + public static final UniffiFree INSTANCE = new UniffiFree(); + + private UniffiFree() {} + + @Override + public void callback(long handle) { + FfiConverterTypeMlsStorageProvider.INSTANCE.handleMap.remove(handle); + } + } + + public static class UniffiClone implements UniffiCallbackInterfaceClone.Fn { + public static final UniffiClone INSTANCE = new UniffiClone(); + + private UniffiClone() {} + + @Override + public long callback(long handle) { + return FfiConverterTypeMlsStorageProvider.INSTANCE.handleMap.clone(handle); + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod0.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod0.java new file mode 100644 index 00000000..1eb597e3 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod0.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceMlsStorageProviderMethod0 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment data,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod1.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod1.java new file mode 100644 index 00000000..3355d7cd --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod1.java @@ -0,0 +1,30 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceMlsStorageProviderMethod1 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod2.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod2.java new file mode 100644 index 00000000..a5281abd --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod2.java @@ -0,0 +1,30 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceMlsStorageProviderMethod2 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod3.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod3.java new file mode 100644 index 00000000..c426acbc --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceMlsStorageProviderMethod3.java @@ -0,0 +1,29 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceMlsStorageProviderMethod3 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceNostrTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceNostrTransportCallback.java new file mode 100644 index 00000000..6c3d1cea --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceNostrTransportCallback.java @@ -0,0 +1,64 @@ +package com.offlineprotocol.sdk; + + +// Put the implementation in an object so we don't pollute the top-level namespace +public class UniffiCallbackInterfaceNostrTransportCallback { + public static final UniffiCallbackInterfaceNostrTransportCallback INSTANCE = new UniffiCallbackInterfaceNostrTransportCallback(); + java.lang.foreign.MemorySegment vtable; + + UniffiCallbackInterfaceNostrTransportCallback() { + // Use Arena.global() for vtable and upcall stubs - they live for the program lifetime. + // Arena.ofAuto() stubs can be GC'd since storing an address in a struct doesn't + // prevent the Arena from being collected. + vtable = java.lang.foreign.Arena.global().allocate(UniffiVTableCallbackInterfaceNostrTransportCallback.LAYOUT); + UniffiVTableCallbackInterfaceNostrTransportCallback.setuniffiFree(vtable, UniffiCallbackInterfaceFree.toUpcallStub(UniffiFree.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceNostrTransportCallback.setuniffiClone(vtable, UniffiCallbackInterfaceClone.toUpcallStub(UniffiClone.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceNostrTransportCallback.setonMessagesAvailable(vtable, UniffiCallbackInterfaceNostrTransportCallbackMethod0.toUpcallStub(OnMessagesAvailableCallback.INSTANCE, java.lang.foreign.Arena.global())); + } + + // Registers the foreign callback with the Rust side. + void register() { + UniffiLib.uniffi_offline_protocol_uniffi_fn_init_callback_vtable_nostrtransportcallback(vtable); + } + + public static final class OnMessagesAvailableCallback implements UniffiCallbackInterfaceNostrTransportCallbackMethod0.Fn { + public static final OnMessagesAvailableCallback INSTANCE = new OnMessagesAvailableCallback(); + private OnMessagesAvailableCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeNostrTransportCallback.INSTANCE.handleMap.get(uniffiHandle); + java.util.function.Supplier _uniffiMakeCall = () -> { + _uniffiObj.onMessagesAvailable( + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCall(_uniffiCallStatus, _uniffiMakeCall, _uniffiWriteReturn); + } + } + + public static class UniffiFree implements UniffiCallbackInterfaceFree.Fn { + public static final UniffiFree INSTANCE = new UniffiFree(); + + private UniffiFree() {} + + @Override + public void callback(long handle) { + FfiConverterTypeNostrTransportCallback.INSTANCE.handleMap.remove(handle); + } + } + + public static class UniffiClone implements UniffiCallbackInterfaceClone.Fn { + public static final UniffiClone INSTANCE = new UniffiClone(); + + private UniffiClone() {} + + @Override + public long callback(long handle) { + return FfiConverterTypeNostrTransportCallback.INSTANCE.handleMap.clone(handle); + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceNostrTransportCallbackMethod0.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceNostrTransportCallbackMethod0.java new file mode 100644 index 00000000..30b0356e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceNostrTransportCallbackMethod0.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceNostrTransportCallbackMethod0 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProvider.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProvider.java new file mode 100644 index 00000000..1970679c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProvider.java @@ -0,0 +1,161 @@ +package com.offlineprotocol.sdk; + + +// Put the implementation in an object so we don't pollute the top-level namespace +public class UniffiCallbackInterfaceProtocolStateStorageProvider { + public static final UniffiCallbackInterfaceProtocolStateStorageProvider INSTANCE = new UniffiCallbackInterfaceProtocolStateStorageProvider(); + java.lang.foreign.MemorySegment vtable; + + UniffiCallbackInterfaceProtocolStateStorageProvider() { + // Use Arena.global() for vtable and upcall stubs - they live for the program lifetime. + // Arena.ofAuto() stubs can be GC'd since storing an address in a struct doesn't + // prevent the Arena from being collected. + vtable = java.lang.foreign.Arena.global().allocate(UniffiVTableCallbackInterfaceProtocolStateStorageProvider.LAYOUT); + UniffiVTableCallbackInterfaceProtocolStateStorageProvider.setuniffiFree(vtable, UniffiCallbackInterfaceFree.toUpcallStub(UniffiFree.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceProtocolStateStorageProvider.setuniffiClone(vtable, UniffiCallbackInterfaceClone.toUpcallStub(UniffiClone.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceProtocolStateStorageProvider.setstore(vtable, UniffiCallbackInterfaceProtocolStateStorageProviderMethod0.toUpcallStub(StoreCallback.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceProtocolStateStorageProvider.setload(vtable, UniffiCallbackInterfaceProtocolStateStorageProviderMethod1.toUpcallStub(LoadCallback.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceProtocolStateStorageProvider.setdelete(vtable, UniffiCallbackInterfaceProtocolStateStorageProviderMethod2.toUpcallStub(DeleteCallback.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceProtocolStateStorageProvider.setlistKeys(vtable, UniffiCallbackInterfaceProtocolStateStorageProviderMethod3.toUpcallStub(ListKeysCallback.INSTANCE, java.lang.foreign.Arena.global())); + } + + // Registers the foreign callback with the Rust side. + void register() { + UniffiLib.uniffi_offline_protocol_uniffi_fn_init_callback_vtable_protocolstatestorageprovider(vtable); + } + + public static final class StoreCallback implements UniffiCallbackInterfaceProtocolStateStorageProviderMethod0.Fn { + public static final StoreCallback INSTANCE = new StoreCallback(); + private StoreCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment data,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeProtocolStateStorageProvider.INSTANCE.handleMap.get(uniffiHandle); + java.util.concurrent.Callable _uniffiMakeCall = () -> { + _uniffiObj.store( + FfiConverterString.INSTANCE.lift(keyType), + FfiConverterString.INSTANCE.lift(keyId), + FfiConverterByteArray.INSTANCE.lift(data) + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCallWithError( + _uniffiCallStatus, + _uniffiMakeCall, + _uniffiWriteReturn, + (MlsStorageException _uniffiErr) -> { return FfiConverterTypeMlsStorageError.INSTANCE.lower(_uniffiErr); }, + MlsStorageException.class + ); + } + } + + public static final class LoadCallback implements UniffiCallbackInterfaceProtocolStateStorageProviderMethod1.Fn { + public static final LoadCallback INSTANCE = new LoadCallback(); + private LoadCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeProtocolStateStorageProvider.INSTANCE.handleMap.get(uniffiHandle); + java.util.concurrent.Callable _uniffiMakeCall = () -> { + return _uniffiObj.load( + FfiConverterString.INSTANCE.lift(keyType), + FfiConverterString.INSTANCE.lift(keyId) + ); + + }; + java.util.function.Consumer _uniffiWriteReturn = (byte[] _uniffiValue) -> { + java.lang.foreign.MemorySegment _uniffiOut = uniffiOutReturn.reinterpret(RustBuffer.LAYOUT.byteSize()); + java.lang.foreign.MemorySegment _uniffiLowered = FfiConverterOptionalByteArray.INSTANCE.lower(_uniffiValue); + java.lang.foreign.MemorySegment.copy(_uniffiLowered, 0, _uniffiOut, 0, RustBuffer.LAYOUT.byteSize()); + }; + UniffiHelpers.uniffiTraitInterfaceCallWithError( + _uniffiCallStatus, + _uniffiMakeCall, + _uniffiWriteReturn, + (MlsStorageException _uniffiErr) -> { return FfiConverterTypeMlsStorageError.INSTANCE.lower(_uniffiErr); }, + MlsStorageException.class + ); + } + } + + public static final class DeleteCallback implements UniffiCallbackInterfaceProtocolStateStorageProviderMethod2.Fn { + public static final DeleteCallback INSTANCE = new DeleteCallback(); + private DeleteCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeProtocolStateStorageProvider.INSTANCE.handleMap.get(uniffiHandle); + java.util.concurrent.Callable _uniffiMakeCall = () -> { + _uniffiObj.delete( + FfiConverterString.INSTANCE.lift(keyType), + FfiConverterString.INSTANCE.lift(keyId) + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCallWithError( + _uniffiCallStatus, + _uniffiMakeCall, + _uniffiWriteReturn, + (MlsStorageException _uniffiErr) -> { return FfiConverterTypeMlsStorageError.INSTANCE.lower(_uniffiErr); }, + MlsStorageException.class + ); + } + } + + public static final class ListKeysCallback implements UniffiCallbackInterfaceProtocolStateStorageProviderMethod3.Fn { + public static final ListKeysCallback INSTANCE = new ListKeysCallback(); + private ListKeysCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeProtocolStateStorageProvider.INSTANCE.handleMap.get(uniffiHandle); + java.util.concurrent.Callable> _uniffiMakeCall = () -> { + return _uniffiObj.listKeys( + FfiConverterString.INSTANCE.lift(keyType) + ); + + }; + java.util.function.Consumer> _uniffiWriteReturn = (java.util.List _uniffiValue) -> { + java.lang.foreign.MemorySegment _uniffiOut = uniffiOutReturn.reinterpret(RustBuffer.LAYOUT.byteSize()); + java.lang.foreign.MemorySegment _uniffiLowered = FfiConverterSequenceString.INSTANCE.lower(_uniffiValue); + java.lang.foreign.MemorySegment.copy(_uniffiLowered, 0, _uniffiOut, 0, RustBuffer.LAYOUT.byteSize()); + }; + UniffiHelpers.uniffiTraitInterfaceCallWithError( + _uniffiCallStatus, + _uniffiMakeCall, + _uniffiWriteReturn, + (MlsStorageException _uniffiErr) -> { return FfiConverterTypeMlsStorageError.INSTANCE.lower(_uniffiErr); }, + MlsStorageException.class + ); + } + } + + public static class UniffiFree implements UniffiCallbackInterfaceFree.Fn { + public static final UniffiFree INSTANCE = new UniffiFree(); + + private UniffiFree() {} + + @Override + public void callback(long handle) { + FfiConverterTypeProtocolStateStorageProvider.INSTANCE.handleMap.remove(handle); + } + } + + public static class UniffiClone implements UniffiCallbackInterfaceClone.Fn { + public static final UniffiClone INSTANCE = new UniffiClone(); + + private UniffiClone() {} + + @Override + public long callback(long handle) { + return FfiConverterTypeProtocolStateStorageProvider.INSTANCE.handleMap.clone(handle); + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod0.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod0.java new file mode 100644 index 00000000..4f6e1dee --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod0.java @@ -0,0 +1,31 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceProtocolStateStorageProviderMethod0 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment data,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod1.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod1.java new file mode 100644 index 00000000..34c6e82d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod1.java @@ -0,0 +1,30 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceProtocolStateStorageProviderMethod1 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod2.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod2.java new file mode 100644 index 00000000..10255658 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod2.java @@ -0,0 +1,30 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceProtocolStateStorageProviderMethod2 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment keyId,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod3.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod3.java new file mode 100644 index 00000000..f3bd794e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceProtocolStateStorageProviderMethod3.java @@ -0,0 +1,29 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceProtocolStateStorageProviderMethod3 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment keyType,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceReticulumTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceReticulumTransportCallback.java new file mode 100644 index 00000000..b3cb28e3 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceReticulumTransportCallback.java @@ -0,0 +1,64 @@ +package com.offlineprotocol.sdk; + + +// Put the implementation in an object so we don't pollute the top-level namespace +public class UniffiCallbackInterfaceReticulumTransportCallback { + public static final UniffiCallbackInterfaceReticulumTransportCallback INSTANCE = new UniffiCallbackInterfaceReticulumTransportCallback(); + java.lang.foreign.MemorySegment vtable; + + UniffiCallbackInterfaceReticulumTransportCallback() { + // Use Arena.global() for vtable and upcall stubs - they live for the program lifetime. + // Arena.ofAuto() stubs can be GC'd since storing an address in a struct doesn't + // prevent the Arena from being collected. + vtable = java.lang.foreign.Arena.global().allocate(UniffiVTableCallbackInterfaceReticulumTransportCallback.LAYOUT); + UniffiVTableCallbackInterfaceReticulumTransportCallback.setuniffiFree(vtable, UniffiCallbackInterfaceFree.toUpcallStub(UniffiFree.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceReticulumTransportCallback.setuniffiClone(vtable, UniffiCallbackInterfaceClone.toUpcallStub(UniffiClone.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceReticulumTransportCallback.setonMessagesAvailable(vtable, UniffiCallbackInterfaceReticulumTransportCallbackMethod0.toUpcallStub(OnMessagesAvailableCallback.INSTANCE, java.lang.foreign.Arena.global())); + } + + // Registers the foreign callback with the Rust side. + void register() { + UniffiLib.uniffi_offline_protocol_uniffi_fn_init_callback_vtable_reticulumtransportcallback(vtable); + } + + public static final class OnMessagesAvailableCallback implements UniffiCallbackInterfaceReticulumTransportCallbackMethod0.Fn { + public static final OnMessagesAvailableCallback INSTANCE = new OnMessagesAvailableCallback(); + private OnMessagesAvailableCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeReticulumTransportCallback.INSTANCE.handleMap.get(uniffiHandle); + java.util.function.Supplier _uniffiMakeCall = () -> { + _uniffiObj.onMessagesAvailable( + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCall(_uniffiCallStatus, _uniffiMakeCall, _uniffiWriteReturn); + } + } + + public static class UniffiFree implements UniffiCallbackInterfaceFree.Fn { + public static final UniffiFree INSTANCE = new UniffiFree(); + + private UniffiFree() {} + + @Override + public void callback(long handle) { + FfiConverterTypeReticulumTransportCallback.INSTANCE.handleMap.remove(handle); + } + } + + public static class UniffiClone implements UniffiCallbackInterfaceClone.Fn { + public static final UniffiClone INSTANCE = new UniffiClone(); + + private UniffiClone() {} + + @Override + public long callback(long handle) { + return FfiConverterTypeReticulumTransportCallback.INSTANCE.handleMap.clone(handle); + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceReticulumTransportCallbackMethod0.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceReticulumTransportCallbackMethod0.java new file mode 100644 index 00000000..a7ccc5e8 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceReticulumTransportCallbackMethod0.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceReticulumTransportCallbackMethod0 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceWifiDirectTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceWifiDirectTransportCallback.java new file mode 100644 index 00000000..c389a586 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceWifiDirectTransportCallback.java @@ -0,0 +1,64 @@ +package com.offlineprotocol.sdk; + + +// Put the implementation in an object so we don't pollute the top-level namespace +public class UniffiCallbackInterfaceWifiDirectTransportCallback { + public static final UniffiCallbackInterfaceWifiDirectTransportCallback INSTANCE = new UniffiCallbackInterfaceWifiDirectTransportCallback(); + java.lang.foreign.MemorySegment vtable; + + UniffiCallbackInterfaceWifiDirectTransportCallback() { + // Use Arena.global() for vtable and upcall stubs - they live for the program lifetime. + // Arena.ofAuto() stubs can be GC'd since storing an address in a struct doesn't + // prevent the Arena from being collected. + vtable = java.lang.foreign.Arena.global().allocate(UniffiVTableCallbackInterfaceWifiDirectTransportCallback.LAYOUT); + UniffiVTableCallbackInterfaceWifiDirectTransportCallback.setuniffiFree(vtable, UniffiCallbackInterfaceFree.toUpcallStub(UniffiFree.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceWifiDirectTransportCallback.setuniffiClone(vtable, UniffiCallbackInterfaceClone.toUpcallStub(UniffiClone.INSTANCE, java.lang.foreign.Arena.global())); + UniffiVTableCallbackInterfaceWifiDirectTransportCallback.setonMessagesAvailable(vtable, UniffiCallbackInterfaceWifiDirectTransportCallbackMethod0.toUpcallStub(OnMessagesAvailableCallback.INSTANCE, java.lang.foreign.Arena.global())); + } + + // Registers the foreign callback with the Rust side. + void register() { + UniffiLib.uniffi_offline_protocol_uniffi_fn_init_callback_vtable_wifidirecttransportcallback(vtable); + } + + public static final class OnMessagesAvailableCallback implements UniffiCallbackInterfaceWifiDirectTransportCallbackMethod0.Fn { + public static final OnMessagesAvailableCallback INSTANCE = new OnMessagesAvailableCallback(); + private OnMessagesAvailableCallback() {} + + @Override + public void callback(long uniffiHandle,java.lang.foreign.MemorySegment uniffiOutReturn,java.lang.foreign.MemorySegment _uniffiCallStatus) { + _uniffiCallStatus = _uniffiCallStatus.reinterpret(UniffiRustCallStatus.LAYOUT.byteSize()); + var _uniffiObj = FfiConverterTypeWifiDirectTransportCallback.INSTANCE.handleMap.get(uniffiHandle); + java.util.function.Supplier _uniffiMakeCall = () -> { + _uniffiObj.onMessagesAvailable( + ); + return null; + }; + java.util.function.Consumer _uniffiWriteReturn = (_uniffiNothing) -> {}; + UniffiHelpers.uniffiTraitInterfaceCall(_uniffiCallStatus, _uniffiMakeCall, _uniffiWriteReturn); + } + } + + public static class UniffiFree implements UniffiCallbackInterfaceFree.Fn { + public static final UniffiFree INSTANCE = new UniffiFree(); + + private UniffiFree() {} + + @Override + public void callback(long handle) { + FfiConverterTypeWifiDirectTransportCallback.INSTANCE.handleMap.remove(handle); + } + } + + public static class UniffiClone implements UniffiCallbackInterfaceClone.Fn { + public static final UniffiClone INSTANCE = new UniffiClone(); + + private UniffiClone() {} + + @Override + public long callback(long handle) { + return FfiConverterTypeWifiDirectTransportCallback.INSTANCE.handleMap.clone(handle); + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceWifiDirectTransportCallbackMethod0.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceWifiDirectTransportCallbackMethod0.java new file mode 100644 index 00000000..cd562aa2 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCallbackInterfaceWifiDirectTransportCallbackMethod0.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiCallbackInterfaceWifiDirectTransportCallbackMethod0 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS); + + @FunctionalInterface + public interface Fn { + void callback(long uniffiHandle,java.lang.foreign.MemorySegment uniffiOutReturn, + java.lang.foreign.MemorySegment _uniffiCallStatus); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + ,java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCleaner.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCleaner.java new file mode 100644 index 00000000..57367230 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiCleaner.java @@ -0,0 +1,20 @@ +package com.offlineprotocol.sdk; + + +// The cleaner interface for Object finalization code to run. +// Uses a custom PhantomReference-based implementation that provides backpressure: +// when objects are created faster than the background cleaner thread can process them, +// the registering thread drains pending cleanups inline, preventing OOM in +// high-throughput scenarios (e.g., benchmarks, tight loops without explicit close()). +interface UniffiCleaner { + interface Cleanable { + void clean(); + } + + UniffiCleaner.Cleanable register(java.lang.Object value, java.lang.Runnable cleanUpTask); + + public static UniffiCleaner create() { + return new UniffiBackpressureCleaner(); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiDeepValue.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiDeepValue.java new file mode 100644 index 00000000..509f89a0 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiDeepValue.java @@ -0,0 +1,65 @@ +package com.offlineprotocol.sdk; + + +// Value equality for generated fields whose rendering holds a Java array at some depth: +// primitive arrays from `Vec`, `byte[]` from `bytes`, possibly under lists, maps, or null. +// Arrays compare and hash by identity, so `Objects.equals` is wrong for them anywhere it would +// reach one. Map keys never hold arrays (hashed positions render boxed), so key lookups here +// match by value. +final class UniffiDeepValue { + private UniffiDeepValue() {} + + static boolean equals(java.lang.Object a, java.lang.Object b) { + if (a == b) return true; + if (a instanceof java.util.List x && b instanceof java.util.List y) { + if (x.size() != y.size()) return false; + java.util.Iterator i = x.iterator(); + java.util.Iterator j = y.iterator(); + while (i.hasNext()) { + if (!equals(i.next(), j.next())) return false; + } + return true; + } + if (a instanceof java.util.Map x && b instanceof java.util.Map y) { + if (x.size() != y.size()) return false; + for (java.util.Map.Entry e : x.entrySet()) { + if (!y.containsKey(e.getKey()) || !equals(e.getValue(), y.get(e.getKey()))) { + return false; + } + } + return true; + } + // Covers every primitive array type, so no per-type Arrays.equals arms are needed. + return java.util.Objects.deepEquals(a, b); + } + + // Per-type arms rather than an Arrays.deepHashCode wrapper: equals has an allocation-free + // JDK entry point in Objects.deepEquals, hashCode does not. + static int hashCode(java.lang.Object o) { + if (o == null) return 0; + if (o instanceof byte[] x) return java.util.Arrays.hashCode(x); + if (o instanceof short[] x) return java.util.Arrays.hashCode(x); + if (o instanceof int[] x) return java.util.Arrays.hashCode(x); + if (o instanceof long[] x) return java.util.Arrays.hashCode(x); + if (o instanceof float[] x) return java.util.Arrays.hashCode(x); + if (o instanceof double[] x) return java.util.Arrays.hashCode(x); + if (o instanceof boolean[] x) return java.util.Arrays.hashCode(x); + if (o instanceof java.util.List x) { + // The List.hashCode contract, with array-aware element hashes. + int result = 1; + for (java.lang.Object e : x) { + result = 31 * result + hashCode(e); + } + return result; + } + if (o instanceof java.util.Map x) { + // The Map.hashCode contract, with array-aware value hashes. + int result = 0; + for (java.util.Map.Entry e : x.entrySet()) { + result += java.util.Objects.hashCode(e.getKey()) ^ hashCode(e.getValue()); + } + return result; + } + return o.hashCode(); + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteF32.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteF32.java new file mode 100644 index 00000000..b3627684 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteF32.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteF32 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultF32.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteF64.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteF64.java new file mode 100644 index 00000000..01f78e56 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteF64.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteF64 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultF64.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI16.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI16.java new file mode 100644 index 00000000..841def6f --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI16.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteI16 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultI16.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI32.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI32.java new file mode 100644 index 00000000..c760dfcb --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI32.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteI32 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultI32.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI64.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI64.java new file mode 100644 index 00000000..13301e52 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI64.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteI64 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultI64.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI8.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI8.java new file mode 100644 index 00000000..4c13cb97 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteI8.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteI8 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultI8.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteRustBuffer.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteRustBuffer.java new file mode 100644 index 00000000..bb141946 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteRustBuffer.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteRustBuffer { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultRustBuffer.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU16.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU16.java new file mode 100644 index 00000000..d132b66d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU16.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteU16 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultU16.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU32.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU32.java new file mode 100644 index 00000000..401c435e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU32.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteU32 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultU32.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU64.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU64.java new file mode 100644 index 00000000..3377aa50 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU64.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteU64 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultU64.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU8.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU8.java new file mode 100644 index 00000000..6daa32fa --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteU8.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteU8 { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultU8.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteVoid.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteVoid.java new file mode 100644 index 00000000..b3c6b9a5 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureCompleteVoid.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureCompleteVoid { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, UniffiForeignFutureResultVoid.LAYOUT); + + @FunctionalInterface + public interface Fn { + void callback(long callbackData,java.lang.foreign.MemorySegment result); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + java.lang.foreign.MemorySegment.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureDroppedCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureDroppedCallback.java new file mode 100644 index 00000000..bb6b9e63 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureDroppedCallback.java @@ -0,0 +1,25 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureDroppedCallback { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG); + + @FunctionalInterface + public interface Fn { + void callback(long handle); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureDroppedCallbackStruct.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureDroppedCallbackStruct.java new file mode 100644 index 00000000..e2609aa9 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureDroppedCallbackStruct.java @@ -0,0 +1,38 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureDroppedCallbackStruct { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_LONG.withName("handle"), + java.lang.foreign.ValueLayout.ADDRESS.withName("free") + ); + + private static final long OFFSET_handle = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("handle")); + + private static final long OFFSET_free = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("free")); + + private UniffiForeignFutureDroppedCallbackStruct() {} + public static long gethandle(java.lang.foreign.MemorySegment seg) { + return (long) seg.get(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_handle); + } + + public static void sethandle(java.lang.foreign.MemorySegment seg, long value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_handle, value); + } + public static java.lang.foreign.MemorySegment getfree(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_free); + } + + public static void setfree(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_free, value); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultF32.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultF32.java new file mode 100644 index 00000000..16e73204 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultF32.java @@ -0,0 +1,39 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultF32 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_FLOAT.withName("returnValue"), + java.lang.foreign.MemoryLayout.paddingLayout(4), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultF32() {} + public static float getreturnValue(java.lang.foreign.MemorySegment seg) { + return (float) seg.get(java.lang.foreign.ValueLayout.JAVA_FLOAT_UNALIGNED, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, float value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_FLOAT_UNALIGNED, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultF64.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultF64.java new file mode 100644 index 00000000..8f6c8e9b --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultF64.java @@ -0,0 +1,38 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultF64 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_DOUBLE.withName("returnValue"), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultF64() {} + public static double getreturnValue(java.lang.foreign.MemorySegment seg) { + return (double) seg.get(java.lang.foreign.ValueLayout.JAVA_DOUBLE_UNALIGNED, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, double value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_DOUBLE_UNALIGNED, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI16.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI16.java new file mode 100644 index 00000000..5b4af022 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI16.java @@ -0,0 +1,39 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultI16 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_SHORT.withName("returnValue"), + java.lang.foreign.MemoryLayout.paddingLayout(6), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultI16() {} + public static short getreturnValue(java.lang.foreign.MemorySegment seg) { + return (short) seg.get(java.lang.foreign.ValueLayout.JAVA_SHORT_UNALIGNED, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, short value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_SHORT_UNALIGNED, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI32.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI32.java new file mode 100644 index 00000000..53b98cc4 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI32.java @@ -0,0 +1,39 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultI32 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_INT.withName("returnValue"), + java.lang.foreign.MemoryLayout.paddingLayout(4), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultI32() {} + public static int getreturnValue(java.lang.foreign.MemorySegment seg) { + return (int) seg.get(java.lang.foreign.ValueLayout.JAVA_INT_UNALIGNED, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, int value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_INT_UNALIGNED, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI64.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI64.java new file mode 100644 index 00000000..685e1d6d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI64.java @@ -0,0 +1,38 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultI64 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_LONG.withName("returnValue"), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultI64() {} + public static long getreturnValue(java.lang.foreign.MemorySegment seg) { + return (long) seg.get(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, long value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI8.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI8.java new file mode 100644 index 00000000..082dd06e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultI8.java @@ -0,0 +1,39 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultI8 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_BYTE.withName("returnValue"), + java.lang.foreign.MemoryLayout.paddingLayout(7), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultI8() {} + public static byte getreturnValue(java.lang.foreign.MemorySegment seg) { + return (byte) seg.get(java.lang.foreign.ValueLayout.JAVA_BYTE, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, byte value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_BYTE, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultRustBuffer.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultRustBuffer.java new file mode 100644 index 00000000..aff92f9a --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultRustBuffer.java @@ -0,0 +1,38 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultRustBuffer { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + RustBuffer.LAYOUT.withName("returnValue"), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultRustBuffer() {} + public static java.lang.foreign.MemorySegment getreturnValue(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_returnValue, RustBuffer.LAYOUT.byteSize()); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_returnValue, RustBuffer.LAYOUT.byteSize()); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU16.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU16.java new file mode 100644 index 00000000..04a40e92 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU16.java @@ -0,0 +1,39 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultU16 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_SHORT.withName("returnValue"), + java.lang.foreign.MemoryLayout.paddingLayout(6), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultU16() {} + public static short getreturnValue(java.lang.foreign.MemorySegment seg) { + return (short) seg.get(java.lang.foreign.ValueLayout.JAVA_SHORT_UNALIGNED, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, short value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_SHORT_UNALIGNED, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU32.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU32.java new file mode 100644 index 00000000..7a8bbed2 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU32.java @@ -0,0 +1,39 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultU32 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_INT.withName("returnValue"), + java.lang.foreign.MemoryLayout.paddingLayout(4), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultU32() {} + public static int getreturnValue(java.lang.foreign.MemorySegment seg) { + return (int) seg.get(java.lang.foreign.ValueLayout.JAVA_INT_UNALIGNED, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, int value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_INT_UNALIGNED, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU64.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU64.java new file mode 100644 index 00000000..4d3f2f9c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU64.java @@ -0,0 +1,38 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultU64 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_LONG.withName("returnValue"), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultU64() {} + public static long getreturnValue(java.lang.foreign.MemorySegment seg) { + return (long) seg.get(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, long value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_LONG_UNALIGNED, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU8.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU8.java new file mode 100644 index 00000000..9ab35087 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultU8.java @@ -0,0 +1,39 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultU8 { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_BYTE.withName("returnValue"), + java.lang.foreign.MemoryLayout.paddingLayout(7), + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_returnValue = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("returnValue")); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultU8() {} + public static byte getreturnValue(java.lang.foreign.MemorySegment seg) { + return (byte) seg.get(java.lang.foreign.ValueLayout.JAVA_BYTE, OFFSET_returnValue); + } + + public static void setreturnValue(java.lang.foreign.MemorySegment seg, byte value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_BYTE, OFFSET_returnValue, value); + } + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultVoid.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultVoid.java new file mode 100644 index 00000000..70d3d3ed --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiForeignFutureResultVoid.java @@ -0,0 +1,28 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiForeignFutureResultVoid { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + UniffiRustCallStatus.LAYOUT.withName("callStatus") + ); + + private static final long OFFSET_callStatus = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("callStatus")); + + private UniffiForeignFutureResultVoid() {} + public static java.lang.foreign.MemorySegment getcallStatus(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + public static void setcallStatus(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + java.lang.foreign.MemorySegment.copy(value, 0, seg, OFFSET_callStatus, UniffiRustCallStatus.LAYOUT.byteSize()); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiHandleMap.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiHandleMap.java new file mode 100644 index 00000000..b08aa82c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiHandleMap.java @@ -0,0 +1,51 @@ +package com.offlineprotocol.sdk; + + +// This is used pass an opaque 64-bit handle representing a foreign object to the Rust code. +// Handles are always odd numbers (LSB = 1) to distinguish them from Rust handles (which are even). +class UniffiHandleMap { + private final java.util.concurrent.ConcurrentHashMap map = new java.util.concurrent.ConcurrentHashMap<>(); + // Start at 1 and increment by 2 to always produce odd handles + private static final long UNIFFI_HANDLEMAP_INITIAL = 1L; + private static final long UNIFFI_HANDLEMAP_DELTA = 2L; + private final java.util.concurrent.atomic.AtomicLong counter = new java.util.concurrent.atomic.AtomicLong(UNIFFI_HANDLEMAP_INITIAL); + + public int size() { + return map.size(); + } + + // Insert a new object into the handle map and get a handle for it + // Handles are always odd (LSB = 1) to distinguish from Rust handles + public long insert(T obj) { + long handle = counter.getAndAdd(UNIFFI_HANDLEMAP_DELTA); + map.put(handle, obj); + return handle; + } + + // Get an object from the handle map + public T get(long handle) { + T obj = map.get(handle); + if (obj == null) { + throw new InternalException("UniffiHandleMap.get: Invalid handle"); + } + return obj; + } + + // Remove an entry from the handlemap and get the Java object back + public T remove(long handle) { + T obj = map.remove(handle); + if (obj == null) { + throw new InternalException("UniffiHandleMap: Invalid handle"); + } + return obj; + } + + // Clone a handle - create a new handle pointing to the same object + public long clone(long handle) { + T obj = get(handle); + return insert(obj); + } +} + +// Contains loading, initialization code, +// and the FFI Function declarations using Java FFM (Foreign Function & Memory API). diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiHelpers.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiHelpers.java new file mode 100644 index 00000000..c1ee0f0d --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiHelpers.java @@ -0,0 +1,261 @@ +package com.offlineprotocol.sdk; + + +// Helpers for calling Rust +// In practice we usually need to be synchronized to call this safely, so it doesn't +// synchronize itself +public final class UniffiHelpers { + // Thread-local reusable RustCallStatus to avoid allocation on the hot path + private static final ThreadLocal REUSABLE_STATUS = ThreadLocal.withInitial(() -> + java.lang.foreign.Arena.global().allocate(UniffiRustCallStatus.LAYOUT) + ); + + // Slab allocator for struct return values from FFI downcalls. + // See UniffiSlabAllocator for the design rationale. + private static final UniffiSlabAllocator RETURN_ALLOCATOR = new UniffiSlabAllocator(RustBuffer.LAYOUT, 1024); + + + @FunctionalInterface + public interface UniffiRustCallFunction { + U apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + @FunctionalInterface + public interface UniffiRustCallVoidFunction { + void apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + // Call a rust function that returns a Result<>. Pass in the Error class companion that + // corresponds to the Err. + static U uniffiRustCallWithError( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + U returnValue = callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + return returnValue; + } + + // Overload for void-returning functions + static void uniffiRustCallWithError( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallVoidFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + } + + // Check UniffiRustCallStatus and throw an error if the call wasn't successful + static void uniffiCheckCallStatus( + UniffiRustCallStatusErrorHandler errorHandler, + java.lang.foreign.MemorySegment status) throws E { + if (UniffiRustCallStatus.isSuccess(status)) { + return; + } else if (UniffiRustCallStatus.isError(status)) { + throw errorHandler.lift(UniffiRustCallStatus.getErrorBuf(status)); + } else if (UniffiRustCallStatus.isPanic(status)) { + java.lang.foreign.MemorySegment errorBuf = UniffiRustCallStatus.getErrorBuf(status); + if (RustBuffer.getLen(errorBuf) > 0) { + throw new InternalException(FfiConverterString.INSTANCE.lift(errorBuf)); + } else { + throw new InternalException("Rust panic"); + } + } else { + throw new InternalException("Unknown rust call status: " + UniffiRustCallStatus.getCode(status)); + } + } + + // Primitive-specialized variants that avoid autoboxing overhead. + // For each primitive type, we have a functional interface + call + callWithError. + + @FunctionalInterface + interface UniffiRustCallLongFunction { + long apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + static long uniffiRustCallWithErrorLong( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallLongFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + long returnValue = callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + return returnValue; + } + + static long uniffiRustCallLong(UniffiRustCallLongFunction callback) { + return uniffiRustCallWithErrorLong(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + @FunctionalInterface + interface UniffiRustCallIntFunction { + int apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + static int uniffiRustCallWithErrorInt( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallIntFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + int returnValue = callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + return returnValue; + } + + static int uniffiRustCallInt(UniffiRustCallIntFunction callback) { + return uniffiRustCallWithErrorInt(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + @FunctionalInterface + interface UniffiRustCallShortFunction { + short apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + static short uniffiRustCallWithErrorShort( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallShortFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + short returnValue = callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + return returnValue; + } + + static short uniffiRustCallShort(UniffiRustCallShortFunction callback) { + return uniffiRustCallWithErrorShort(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + @FunctionalInterface + interface UniffiRustCallByteFunction { + byte apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + static byte uniffiRustCallWithErrorByte( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallByteFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + byte returnValue = callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + return returnValue; + } + + static byte uniffiRustCallByte(UniffiRustCallByteFunction callback) { + return uniffiRustCallWithErrorByte(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + @FunctionalInterface + interface UniffiRustCallFloatFunction { + float apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + static float uniffiRustCallWithErrorFloat( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallFloatFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + float returnValue = callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + return returnValue; + } + + static float uniffiRustCallFloat(UniffiRustCallFloatFunction callback) { + return uniffiRustCallWithErrorFloat(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + @FunctionalInterface + interface UniffiRustCallDoubleFunction { + double apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + static double uniffiRustCallWithErrorDouble( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallDoubleFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + double returnValue = callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + return returnValue; + } + + static double uniffiRustCallDouble(UniffiRustCallDoubleFunction callback) { + return uniffiRustCallWithErrorDouble(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + @FunctionalInterface + interface UniffiRustCallBooleanFunction { + boolean apply(java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.MemorySegment status); + } + + static boolean uniffiRustCallWithErrorBoolean( + UniffiRustCallStatusErrorHandler errorHandler, + UniffiRustCallBooleanFunction callback) throws E { + java.lang.foreign.MemorySegment status = REUSABLE_STATUS.get(); + status.fill((byte) 0); + boolean returnValue = callback.apply(RETURN_ALLOCATOR, status); + uniffiCheckCallStatus(errorHandler, status); + return returnValue; + } + + static boolean uniffiRustCallBoolean(UniffiRustCallBooleanFunction callback) { + return uniffiRustCallWithErrorBoolean(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + // Call a rust function that returns a plain value + static U uniffiRustCall(UniffiRustCallFunction callback) { + return uniffiRustCallWithError(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + // Call a rust function that returns nothing + static void uniffiRustCall(UniffiRustCallVoidFunction callback) { + uniffiRustCallWithError(new UniffiNullRustCallStatusErrorHandler(), callback); + } + + static void uniffiTraitInterfaceCall( + java.lang.foreign.MemorySegment callStatus, + java.util.function.Supplier makeCall, + java.util.function.Consumer writeReturn + ) { + try { + writeReturn.accept(makeCall.get()); + } catch (java.lang.Exception e) { + UniffiRustCallStatus.setCode(callStatus, UniffiRustCallStatus.UNIFFI_CALL_UNEXPECTED_ERROR); + UniffiRustCallStatus.setErrorBuf(callStatus, FfiConverterString.INSTANCE.lower(uniffiStackTraceToString(e))); + } + } + + private static java.lang.String uniffiStackTraceToString(java.lang.Throwable e) { + try { + java.io.StringWriter sw = new java.io.StringWriter(); + e.printStackTrace(new java.io.PrintWriter(sw)); + return sw.toString(); + } catch (java.lang.Throwable _t) { + return e.toString(); + } + } + + static void uniffiTraitInterfaceCallWithError( + java.lang.foreign.MemorySegment callStatus, + java.util.concurrent.Callable makeCall, + java.util.function.Consumer writeReturn, + java.util.function.Function lowerError, + java.lang.Class errorClazz + ) { + try { + writeReturn.accept(makeCall.call()); + } catch (java.lang.Exception e) { + if (errorClazz.isAssignableFrom(e.getClass())) { + @SuppressWarnings("unchecked") + E castedE = (E) e; + UniffiRustCallStatus.setCode(callStatus, UniffiRustCallStatus.UNIFFI_CALL_ERROR); + UniffiRustCallStatus.setErrorBuf(callStatus, lowerError.apply(castedE)); + } else { + UniffiRustCallStatus.setCode(callStatus, UniffiRustCallStatus.UNIFFI_CALL_UNEXPECTED_ERROR); + UniffiRustCallStatus.setErrorBuf(callStatus, FfiConverterString.INSTANCE.lower(uniffiStackTraceToString(e))); + } + } + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiInitializer.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiInitializer.java new file mode 100644 index 00000000..9a299a37 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiInitializer.java @@ -0,0 +1,22 @@ +package com.offlineprotocol.sdk; + + +/** + * Ensures the native library is initialized. + * Call this function to force initialization before using any types from this library. + */ +public final class UniffiInitializer { + /** + * Force initialization of the native library. + */ + public static void ensureInitialized() { + // Force UniffiLib class to load (runs integrity checks and initialization functions) + Class ignored = UniffiLib.class; + } +} + +// Async support + +// Public interface members begin here. + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiLib.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiLib.java new file mode 100644 index 00000000..3f6b9390 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiLib.java @@ -0,0 +1,4748 @@ +package com.offlineprotocol.sdk; + + +// FFM-based library binding. Each FFI function gets a MethodHandle and a wrapper method. +final class UniffiLib { + private static final java.lang.foreign.Linker LINKER = java.lang.foreign.Linker.nativeLinker(); + private static final java.lang.foreign.SymbolLookup SYMBOLS; + + + // The Cleaner for the whole library + static UniffiCleaner CLEANER; + + static { + SYMBOLS = NamespaceLibrary.loadLibrary(); + } + + private static java.lang.invoke.MethodHandle findDowncallHandle(String name, java.lang.foreign.FunctionDescriptor descriptor) { + return SYMBOLS.find(name) + .map(s -> LINKER.downcallHandle(s, descriptor)) + .orElseThrow(() -> new RuntimeException("Missing FFI symbol: " + name)); + } + + // uniffi_offline_protocol_uniffi_fn_clone_datastore + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_clone_datastore = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_clone_datastore", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_clone_datastore(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_clone_datastore.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_free_datastore + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_free_datastore = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_free_datastore", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_free_datastore(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_free_datastore.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_constructor_datastore_new + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_constructor_datastore_new = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_constructor_datastore_new", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_constructor_datastore_new(long protocol, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_constructor_datastore_new.invokeExact(protocol, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_constructor_datastore_with_storage + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_constructor_datastore_with_storage = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_constructor_datastore_with_storage", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_constructor_datastore_with_storage(long protocol, long storage, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_constructor_datastore_with_storage.invokeExact(protocol, storage, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_attachment_hash + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_attachment_hash = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_attachment_hash", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_datastore_attachment_hash(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_attachment_hash.invokeExact(_allocator, ptr, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_counter_increment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_counter_increment = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_counter_increment", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_DOUBLE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_counter_increment(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, double amount, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_counter_increment.invokeExact(ptr, spaceId, docId, collection, amount, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_counter_value + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_counter_value = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_counter_value", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_DOUBLE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static double uniffi_offline_protocol_uniffi_fn_method_datastore_counter_value(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (double) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_counter_value.invokeExact(ptr, spaceId, docId, collection, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_create_doc + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_create_doc = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_create_doc", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_create_doc(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_create_doc.invokeExact(ptr, spaceId, docId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_decline_attachment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_decline_attachment = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_decline_attachment", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_decline_attachment(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment hash, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_decline_attachment.invokeExact(ptr, spaceId, peerId, hash, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_delete_doc + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_delete_doc = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_delete_doc", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_delete_doc(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_delete_doc.invokeExact(ptr, spaceId, docId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_doc_json + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_doc_json = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_doc_json", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_datastore_doc_json(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_doc_json.invokeExact(_allocator, ptr, spaceId, docId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_doc_size + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_doc_size = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_doc_size", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_method_datastore_doc_size(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_doc_size.invokeExact(ptr, spaceId, docId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_export_raw + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_export_raw = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_export_raw", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_datastore_export_raw(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_export_raw.invokeExact(_allocator, ptr, spaceId, docId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment hash, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment.invokeExact(ptr, spaceId, hash, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment_from + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment_from = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment_from", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment_from(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment hash, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_fetch_attachment_from.invokeExact(ptr, spaceId, peerId, hash, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_flush + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_flush = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_flush", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_flush(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_flush.invokeExact(ptr, spaceId, docId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_flush_all + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_flush_all = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_flush_all", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_flush_all(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_flush_all.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_list_delete + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_delete = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_list_delete", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_list_delete(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, int index, int count, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_delete.invokeExact(ptr, spaceId, docId, collection, index, count, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_list_docs + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_docs = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_list_docs", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_datastore_list_docs(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_docs.invokeExact(_allocator, ptr, spaceId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_list_len + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_len = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_list_len", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static int uniffi_offline_protocol_uniffi_fn_method_datastore_list_len(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (int) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_len.invokeExact(ptr, spaceId, docId, collection, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_list_push + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_push = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_list_push", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_list_push(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, java.lang.foreign.MemorySegment valueJson, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_push.invokeExact(ptr, spaceId, docId, collection, valueJson, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_list_spaces + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_spaces = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_list_spaces", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_datastore_list_spaces(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_list_spaces.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_map_delete + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_map_delete = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_map_delete", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_map_delete(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, java.lang.foreign.MemorySegment key, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_map_delete.invokeExact(ptr, spaceId, docId, collection, key, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_map_get_json + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_map_get_json = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_map_get_json", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_datastore_map_get_json(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, java.lang.foreign.MemorySegment key, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_map_get_json.invokeExact(_allocator, ptr, spaceId, docId, collection, key, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_map_set + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_map_set = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_map_set", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_map_set(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, java.lang.foreign.MemorySegment key, java.lang.foreign.MemorySegment valueJson, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_map_set.invokeExact(ptr, spaceId, docId, collection, key, valueJson, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_provide_attachment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_provide_attachment = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_provide_attachment", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_provide_attachment(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment hash, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_provide_attachment.invokeExact(ptr, spaceId, peerId, hash, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_remove_doc + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_remove_doc = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_remove_doc", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_remove_doc(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_remove_doc.invokeExact(ptr, spaceId, docId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_remove_space + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_remove_space = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_remove_space", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_remove_space(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_remove_space.invokeExact(ptr, spaceId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_set_interest + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_set_interest = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_set_interest", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_set_interest(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment patterns, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_set_interest.invokeExact(ptr, spaceId, patterns, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_text_delete + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_text_delete = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_text_delete", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_text_delete(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, int position, int count, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_text_delete.invokeExact(ptr, spaceId, docId, collection, position, count, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_text_insert + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_text_insert = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_text_insert", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_INT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_text_insert(long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, int position, java.lang.foreign.MemorySegment text, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_text_insert.invokeExact(ptr, spaceId, docId, collection, position, text, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_text_value + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_text_value = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_text_value", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_datastore_text_value(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment spaceId, java.lang.foreign.MemorySegment docId, java.lang.foreign.MemorySegment collection, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_datastore_text_value.invokeExact(_allocator, ptr, spaceId, docId, collection, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_datastore_wipe_all + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_datastore_wipe_all = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_datastore_wipe_all", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_datastore_wipe_all(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_datastore_wipe_all.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_clone_meshservices + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_clone_meshservices = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_clone_meshservices", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_clone_meshservices(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_clone_meshservices.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_free_meshservices + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_free_meshservices = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_free_meshservices", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_free_meshservices(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_free_meshservices.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_constructor_meshservices_new + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_constructor_meshservices_new = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_constructor_meshservices_new", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_constructor_meshservices_new(long protocol, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_constructor_meshservices_new.invokeExact(protocol, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_meshservices_discover_services + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_discover_services = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_meshservices_discover_services", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_meshservices_discover_services(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment serviceId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_discover_services.invokeExact(_allocator, ptr, serviceId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_meshservices_register_service + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_register_service = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_meshservices_register_service", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_meshservices_register_service(long ptr, java.lang.foreign.MemorySegment serviceId, java.lang.foreign.MemorySegment version, java.lang.foreign.MemorySegment capabilities, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_register_service.invokeExact(ptr, serviceId, version, capabilities, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_meshservices_respond_to_service_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_respond_to_service_request = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_meshservices_respond_to_service_request", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_meshservices_respond_to_service_request(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment requestId, java.lang.foreign.MemorySegment requester, java.lang.foreign.MemorySegment serviceId, java.lang.foreign.MemorySegment status, java.lang.foreign.MemorySegment body, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_respond_to_service_request.invokeExact(_allocator, ptr, requestId, requester, serviceId, status, body, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_meshservices_send_service_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_send_service_request = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_meshservices_send_service_request", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_meshservices_send_service_request(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment provider, java.lang.foreign.MemorySegment serviceId, java.lang.foreign.MemorySegment method, java.lang.foreign.MemorySegment body, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_send_service_request.invokeExact(_allocator, ptr, provider, serviceId, method, body, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_meshservices_unregister_service + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_unregister_service = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_meshservices_unregister_service", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_meshservices_unregister_service(long ptr, java.lang.foreign.MemorySegment serviceId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_meshservices_unregister_service.invokeExact(ptr, serviceId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_clone_offlineprotocol + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_clone_offlineprotocol = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_clone_offlineprotocol", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_clone_offlineprotocol(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_clone_offlineprotocol.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_free_offlineprotocol + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_free_offlineprotocol = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_free_offlineprotocol", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_free_offlineprotocol(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_free_offlineprotocol.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_constructor_offlineprotocol_new + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_constructor_offlineprotocol_new = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_constructor_offlineprotocol_new", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_constructor_offlineprotocol_new(java.lang.foreign.MemorySegment config, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_constructor_offlineprotocol_new.invokeExact(config, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_accept_connection_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_accept_connection_request = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_accept_connection_request", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_accept_connection_request(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment accepterName, java.lang.foreign.MemorySegment keyPackage, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_accept_connection_request.invokeExact(_allocator, ptr, recipient, accepterName, keyPackage, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_clear_peer_mtu + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_clear_peer_mtu = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_clear_peer_mtu", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_clear_peer_mtu(long ptr, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_clear_peer_mtu.invokeExact(ptr, peerId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_fallback_count + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_fallback_count = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_fallback_count", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_fallback_count(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_fallback_count.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_received = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_received", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_received(long ptr, java.lang.foreign.MemorySegment senderId, java.lang.foreign.MemorySegment fragment, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_fragment_received.invokeExact(ptr, senderId, fragment, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_next_fragment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_next_fragment = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_next_fragment", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_next_fragment(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_next_fragment.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_peer_count + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_peer_count = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_peer_count", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static int uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_peer_count(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (int) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_get_peer_count.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_discovered + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_discovered = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_discovered", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_SHORT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_discovered(long ptr, java.lang.foreign.MemorySegment peerId, short rssi, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_discovered.invokeExact(ptr, peerId, rssi, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_lost + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_lost = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_lost", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_lost(long ptr, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_peer_lost.invokeExact(ptr, peerId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_recipient_not_among_peers_count + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_recipient_not_among_peers_count = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_recipient_not_among_peers_count", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_recipient_not_among_peers_count(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_recipient_not_among_peers_count.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_return_fragment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_return_fragment = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_return_fragment", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_return_fragment(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_return_fragment.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_set_peer_mtu + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_set_peer_mtu = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_set_peer_mtu", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_set_peer_mtu(long ptr, java.lang.foreign.MemorySegment peerId, int maxPayload, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_set_peer_mtu.invokeExact(ptr, peerId, maxPayload, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_status_changed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_status_changed(long ptr, byte isAvailable, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_status_changed.invokeExact(ptr, isAvailable, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_undersized_mtu_reports + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_undersized_mtu_reports = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_undersized_mtu_reports", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_undersized_mtu_reports(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_ble_undersized_mtu_reports.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_block_user + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_block_user = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_block_user", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_block_user(long ptr, java.lang.foreign.MemorySegment userId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_block_user.invokeExact(ptr, userId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_connection_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_connection_request = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_connection_request", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_connection_request(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_connection_request.invokeExact(_allocator, ptr, recipient, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_file_transfer + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_file_transfer = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_file_transfer", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_file_transfer(long ptr, java.lang.foreign.MemorySegment fileId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_cancel_file_transfer.invokeExact(ptr, fileId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_close_file_stores + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_close_file_stores = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_close_file_stores", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_close_file_stores(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_close_file_stores.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_group = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_group", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_group(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment groupName, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_group.invokeExact(_allocator, ptr, groupName, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_invite + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_invite = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_invite", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_invite(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment petname, byte sign, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_create_invite.invokeExact(_allocator, ptr, petname, sign, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_derive_user_id_from_public_key + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_derive_user_id_from_public_key = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_derive_user_id_from_public_key", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_derive_user_id_from_public_key(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment publicKey, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_derive_user_id_from_public_key.invokeExact(_allocator, ptr, publicKey, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_disable_telemetry + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_disable_telemetry = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_disable_telemetry", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_disable_telemetry(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_disable_telemetry.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_emit_test_event + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_emit_test_event = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_emit_test_event", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_emit_test_event(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_emit_test_event.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_enable_telemetry + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_enable_telemetry = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_enable_telemetry", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_enable_telemetry(long ptr, java.lang.foreign.MemorySegment config, java.lang.foreign.MemorySegment appState, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_enable_telemetry.invokeExact(ptr, config, appState, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_end_telemetry_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_end_telemetry_session = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_end_telemetry_session", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_end_telemetry_session(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_end_telemetry_session.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_erase_custody + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_erase_custody = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_erase_custody", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_erase_custody(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_erase_custody.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_establish_secure_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_establish_secure_session = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_establish_secure_session", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_establish_secure_session(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_establish_secure_session.invokeExact(_allocator, ptr, peerId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_finalize_file + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_finalize_file = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_finalize_file", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_finalize_file(long ptr, java.lang.foreign.MemorySegment fileId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_finalize_file.invokeExact(ptr, fileId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry_blocking + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry_blocking = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry_blocking", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry_blocking(long ptr, long deadlineMs, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_flush_telemetry_blocking.invokeExact(ptr, deadlineMs, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_force_transport + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_force_transport = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_force_transport", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_force_transport(long ptr, java.lang.foreign.MemorySegment transportType, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_force_transport.invokeExact(ptr, transportType, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment originalMessageJson, java.lang.foreign.MemorySegment newRecipient, java.lang.foreign.MemorySegment priority, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message.invokeExact(_allocator, ptr, originalMessageJson, newRecipient, priority, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message_to_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message_to_group = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message_to_group", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message_to_group(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment originalMessageJson, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment priority, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_forward_message_to_group.invokeExact(_allocator, ptr, originalMessageJson, groupId, priority, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_gateway_address_declaration + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_gateway_address_declaration = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_gateway_address_declaration", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_gateway_address_declaration(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment challenge, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_gateway_address_declaration.invokeExact(_allocator, ptr, challenge, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_active_transports + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_active_transports = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_active_transports", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_active_transports(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_active_transports.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_battery_level + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_battery_level = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_battery_level", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_battery_level(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_battery_level.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_blocked_users + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_blocked_users = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_blocked_users", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_blocked_users(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_blocked_users.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_custody_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_custody_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_custody_stats", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_custody_stats(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_custody_stats.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dedup_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dedup_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dedup_stats", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dedup_stats(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dedup_stats.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_delivery_success_rate + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_delivery_success_rate = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_delivery_success_rate", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_FLOAT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static float uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_delivery_success_rate(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (float) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_delivery_success_rate.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dors_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dors_config = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dors_config", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dors_config(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_dors_config.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_establishment_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_establishment_state = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_establishment_state", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_establishment_state(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_establishment_state.invokeExact(_allocator, ptr, peerId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_file_progress + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_file_progress = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_file_progress", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_file_progress(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment fileId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_file_progress.invokeExact(_allocator, ptr, fileId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_info + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_info = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_info", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_info(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_info.invokeExact(_allocator, ptr, groupId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_roles + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_roles = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_roles", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_roles(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_group_roles.invokeExact(_allocator, ptr, groupId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_identity_public_key + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_identity_public_key = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_identity_public_key", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_identity_public_key(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_identity_public_key.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_is_charging + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_is_charging = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_is_charging", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_is_charging(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_is_charging.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_hops + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_hops = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_hops", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_hops(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_hops.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_latency + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_latency = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_latency", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_latency(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_median_latency.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_member_role + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_member_role = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_member_role", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_member_role(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment userId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_member_role.invokeExact(_allocator, ptr, groupId, userId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_stats", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_stats(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_stats.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_tunables + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_tunables = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_tunables", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_tunables(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_mesh_relay_tunables.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_message_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_message_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_message_stats", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_message_stats(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_message_stats.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_pending_ack_count + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_pending_ack_count = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_pending_ack_count", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_pending_ack_count(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_pending_ack_count.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_config = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_config", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_config(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_config.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_priority + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_priority = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_priority", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_priority(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_relay_priority.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_retry_queue_size + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_retry_queue_size = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_retry_queue_size", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_retry_queue_size(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_retry_queue_size.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_state = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_state", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_state(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_state.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_topology + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_topology = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_topology", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_topology(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_topology.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_transport_metrics + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_transport_metrics = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_transport_metrics", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_transport_metrics(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment transportType, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_get_transport_metrics.invokeExact(_allocator, ptr, transportType, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_relay_sync_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_relay_sync_state = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_relay_sync_state", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_relay_sync_state(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_relay_sync_state.invokeExact(_allocator, ptr, groupId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_rich_readiness + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_rich_readiness = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_rich_readiness", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_rich_readiness(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_group_rich_readiness.invokeExact(_allocator, ptr, groupId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_has_pending_key_package + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_has_pending_key_package = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_has_pending_key_package", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_has_pending_key_package(long ptr, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_has_pending_key_package.invokeExact(ptr, peerId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_identity_assertion + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_identity_assertion = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_identity_assertion", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_identity_assertion(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment signedData, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_identity_assertion.invokeExact(_allocator, ptr, signedData, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls(long ptr, long secureStorage, long protocolStateStorage, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls.invokeExact(ptr, secureStorage, protocolStateStorage, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls_with_file_stores + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls_with_file_stores = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls_with_file_stores", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls_with_file_stores(long ptr, java.lang.foreign.MemorySegment mlsRoot, java.lang.foreign.MemorySegment stateRoot, java.lang.foreign.MemorySegment storeKey, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_initialize_mls_with_file_stores.invokeExact(ptr, mlsRoot, stateRoot, storeKey, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declaration_refused + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declaration_refused = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declaration_refused", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declaration_refused(long ptr, java.lang.foreign.MemorySegment reason, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declaration_refused.invokeExact(ptr, reason, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declared + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declared = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declared", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declared(long ptr, java.lang.foreign.MemorySegment address, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_address_declared.invokeExact(ptr, address, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_confirm_sent + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_confirm_sent = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_confirm_sent", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_confirm_sent(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_confirm_sent.invokeExact(ptr, messageId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_get_next_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_get_next_message = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_get_next_message", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_get_next_message(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_get_next_message.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_group_report_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_group_report_received = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_group_report_received", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_group_report_received(long ptr, java.lang.foreign.MemorySegment reportJson, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_group_report_received.invokeExact(ptr, reportJson, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_message_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_message_received = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_message_received", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_message_received(long ptr, java.lang.foreign.MemorySegment senderId, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_message_received.invokeExact(ptr, senderId, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_peer_presence + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_peer_presence = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_peer_presence", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_BYTE, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_peer_presence(long ptr, java.lang.foreign.MemorySegment peerId, byte online, java.lang.foreign.MemorySegment lastSeenMs, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_peer_presence.invokeExact(ptr, peerId, online, lastSeenMs, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_presence_watchlist + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_presence_watchlist = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_presence_watchlist", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_presence_watchlist(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_presence_watchlist.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_relay_capabilities + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_relay_capabilities = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_relay_capabilities", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_relay_capabilities(long ptr, java.lang.foreign.MemorySegment capabilities, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_relay_capabilities.invokeExact(ptr, capabilities, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed.invokeExact(ptr, messageId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed_with_reason + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed_with_reason = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed_with_reason", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed_with_reason(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment reason, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_send_failed_with_reason.invokeExact(ptr, messageId, reason, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_status_changed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_status_changed(long ptr, byte isConnected, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_internet_status_changed.invokeExact(ptr, isConnected, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_invite_to_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_invite_to_group = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_invite_to_group", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_invite_to_group(long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment inviteeUserId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_invite_to_group.invokeExact(ptr, groupId, inviteeUserId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_mls_initialized + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_mls_initialized = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_mls_initialized", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_mls_initialized(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_mls_initialized.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_relay + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_relay = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_relay", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_relay(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_relay.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_user_blocked + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_user_blocked = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_user_blocked", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_user_blocked(long ptr, java.lang.foreign.MemorySegment userId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_is_user_blocked.invokeExact(ptr, userId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_leave_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_leave_group = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_leave_group", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_leave_group(long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_leave_group.invokeExact(ptr, groupId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_list_groups + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_list_groups = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_list_groups", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_list_groups(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_list_groups.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_local_address + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_local_address = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_local_address", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_local_address(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_local_address.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_clear_pending_welcome + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_clear_pending_welcome = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_clear_pending_welcome", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_clear_pending_welcome(long ptr, java.lang.foreign.MemorySegment otherUserId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_clear_pending_welcome.invokeExact(ptr, otherUserId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_create_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_create_session = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_create_session", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_create_session(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment otherUserId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_create_session.invokeExact(_allocator, ptr, otherUserId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment encrypted, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt.invokeExact(_allocator, ptr, encrypted, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt_from_user + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt_from_user = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt_from_user", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt_from_user(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment encrypted, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_decrypt_from_user.invokeExact(_allocator, ptr, encrypted, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_delete_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_delete_session = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_delete_session", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_delete_session(long ptr, java.lang.foreign.MemorySegment otherUserId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_delete_session.invokeExact(ptr, otherUserId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_encrypt_for_user + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_encrypt_for_user = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_encrypt_for_user", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_encrypt_for_user(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment otherUserId, java.lang.foreign.MemorySegment plaintext, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_encrypt_for_user.invokeExact(_allocator, ptr, otherUserId, plaintext, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_generate_key_package + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_generate_key_package = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_generate_key_package", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_generate_key_package(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_generate_key_package.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_or_create_key_package + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_or_create_key_package = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_or_create_key_package", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_or_create_key_package(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_or_create_key_package.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_key_packages + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_key_packages = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_key_packages", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_key_packages(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_key_packages.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_welcome + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_welcome = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_welcome", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_welcome(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment otherUserId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_get_pending_welcome.invokeExact(_allocator, ptr, otherUserId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_has_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_has_session = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_has_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_has_session(long ptr, java.lang.foreign.MemorySegment otherUserId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_has_session.invokeExact(ptr, otherUserId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_import_key_package + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_import_key_package = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_import_key_package", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_import_key_package(long ptr, java.lang.foreign.MemorySegment userId, java.lang.foreign.MemorySegment keyPackageData, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_import_key_package.invokeExact(ptr, userId, keyPackageData, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_join_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_join_session = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_join_session", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_join_session(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment welcome, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_join_session.invokeExact(_allocator, ptr, welcome, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_list_sessions + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_list_sessions = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_list_sessions", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_list_sessions(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_list_sessions.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_mark_key_package_synced + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_mark_key_package_synced = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_mark_key_package_synced", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_mark_key_package_synced(long ptr, java.lang.foreign.MemorySegment packageId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_mark_key_package_synced.invokeExact(ptr, packageId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_process_welcome + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_process_welcome = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_process_welcome", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_process_welcome(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment welcome, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_mls_process_welcome.invokeExact(_allocator, ptr, welcome, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_confirm_sent + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_confirm_sent = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_confirm_sent", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_confirm_sent(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_confirm_sent.invokeExact(ptr, messageId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_message = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_message", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_message(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_message.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_query + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_query = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_query", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_query(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_next_query.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_public_key + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_public_key = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_public_key", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_public_key(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_public_key.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_subscription_filter + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_subscription_filter = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_subscription_filter", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_subscription_filter(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment subscriptionId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_get_subscription_filter.invokeExact(_allocator, ptr, subscriptionId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received(long ptr, java.lang.foreign.MemorySegment senderId, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received.invokeExact(ptr, senderId, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received_at + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received_at = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received_at", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received_at(long ptr, java.lang.foreign.MemorySegment senderId, java.lang.foreign.MemorySegment data, long createdAt, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_message_received_at.invokeExact(ptr, senderId, data, createdAt, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_completed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_completed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_completed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_completed(long ptr, java.lang.foreign.MemorySegment queryId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_completed.invokeExact(ptr, queryId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_event_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_event_received = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_event_received", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_event_received(long ptr, java.lang.foreign.MemorySegment queryId, java.lang.foreign.MemorySegment eventJson, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_query_event_received.invokeExact(ptr, queryId, eventJson, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed.invokeExact(ptr, messageId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed_with_reason + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed_with_reason = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed_with_reason", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed_with_reason(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment reason, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_send_failed_with_reason.invokeExact(ptr, messageId, reason, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_status_changed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_status_changed(long ptr, byte isConnected, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_nostr_status_changed.invokeExact(ptr, isConnected, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_notify_app_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_notify_app_state = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_notify_app_state", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_notify_app_state(long ptr, java.lang.foreign.MemorySegment state, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_notify_app_state.invokeExact(ptr, state, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_pause + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_pause = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_pause", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_pause(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_pause.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_poll_event + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_poll_event = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_poll_event", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_poll_event(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_poll_event.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process_file_chunk + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process_file_chunk = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process_file_chunk", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process_file_chunk(long ptr, java.lang.foreign.MemorySegment fileId, int chunkIndex, int totalChunks, long fileSize, java.lang.foreign.MemorySegment fileName, java.lang.foreign.MemorySegment fileChecksum, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_process_file_chunk.invokeExact(ptr, fileId, chunkIndex, totalChunks, fileSize, fileName, fileChecksum, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_protocol_lock_diagnostics + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_protocol_lock_diagnostics = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_protocol_lock_diagnostics", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_protocol_lock_diagnostics(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_protocol_lock_diagnostics.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_receive_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_receive_message = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_receive_message", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_receive_message(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_receive_message.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reject_connection_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reject_connection_request = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reject_connection_request", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reject_connection_request(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reject_connection_request.invokeExact(_allocator, ptr, recipient, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rekey_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rekey_session = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rekey_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rekey_session(long ptr, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rekey_session.invokeExact(ptr, peerId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_release_transport_lock + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_release_transport_lock = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_release_transport_lock", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_release_transport_lock(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_release_transport_lock.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_from_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_from_group = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_from_group", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_from_group(long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment memberId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_from_group.invokeExact(ptr, groupId, memberId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_transport + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_transport = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_transport", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_transport(long ptr, java.lang.foreign.MemorySegment transportType, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_remove_transport.invokeExact(ptr, transportType, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rename_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rename_group = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rename_group", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rename_group(long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment newName, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_rename_group.invokeExact(ptr, groupId, newName, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_request_group_relay_registration + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_request_group_relay_registration = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_request_group_relay_registration", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_request_group_relay_registration(long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_request_group_relay_registration.invokeExact(ptr, groupId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resolve_username + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resolve_username = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resolve_username", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resolve_username(long ptr, java.lang.foreign.MemorySegment username, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resolve_username.invokeExact(ptr, username, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resume + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resume = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resume", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resume(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_resume.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declaration_refused + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declaration_refused = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declaration_refused", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declaration_refused(long ptr, java.lang.foreign.MemorySegment reason, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declaration_refused.invokeExact(ptr, reason, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declared + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declared = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declared", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declared(long ptr, java.lang.foreign.MemorySegment address, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_address_declared.invokeExact(ptr, address, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_confirm_sent + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_confirm_sent = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_confirm_sent", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_confirm_sent(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_confirm_sent.invokeExact(ptr, messageId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_gateway_capabilities + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_gateway_capabilities = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_gateway_capabilities", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_gateway_capabilities(long ptr, java.lang.foreign.MemorySegment capabilities, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_gateway_capabilities.invokeExact(ptr, capabilities, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_get_next_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_get_next_message = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_get_next_message", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_get_next_message(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_get_next_message.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_message_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_message_received = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_message_received", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_message_received(long ptr, java.lang.foreign.MemorySegment senderId, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_message_received.invokeExact(ptr, senderId, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_peer_presence + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_peer_presence = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_peer_presence", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_BYTE, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_peer_presence(long ptr, java.lang.foreign.MemorySegment peerId, byte online, java.lang.foreign.MemorySegment lastSeenMs, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_peer_presence.invokeExact(ptr, peerId, online, lastSeenMs, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_presence_watchlist + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_presence_watchlist = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_presence_watchlist", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_presence_watchlist(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_presence_watchlist.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed.invokeExact(ptr, messageId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed_with_reason + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed_with_reason = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed_with_reason", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed_with_reason(long ptr, java.lang.foreign.MemorySegment messageId, java.lang.foreign.MemorySegment reason, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_send_failed_with_reason.invokeExact(ptr, messageId, reason, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_status_changed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_status_changed(long ptr, byte isConnected, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_reticulum_status_changed.invokeExact(ptr, isConnected, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_connection_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_connection_request = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_connection_request", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_connection_request(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment senderName, java.lang.foreign.MemorySegment keyPackage, java.lang.foreign.MemorySegment initialMessage, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_connection_request.invokeExact(_allocator, ptr, recipient, senderName, keyPackage, initialMessage, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_file + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_file = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_file", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_file(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment fileData, java.lang.foreign.MemorySegment fileName, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_file.invokeExact(_allocator, ptr, recipient, fileData, fileName, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_group_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_group_message = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_group_message", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_group_message(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment content, java.lang.foreign.MemorySegment priority, java.lang.foreign.MemorySegment replyToMsg, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_group_message.invokeExact(_allocator, ptr, groupId, content, priority, replyToMsg, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment fileData, java.lang.foreign.MemorySegment fileName, java.lang.foreign.MemorySegment contentType, java.lang.foreign.MemorySegment mediaMetadata, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media.invokeExact(_allocator, ptr, recipient, fileData, fileName, contentType, mediaMetadata, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media_rich + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media_rich = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media_rich", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media_rich(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment fileData, java.lang.foreign.MemorySegment fileName, java.lang.foreign.MemorySegment contentType, java.lang.foreign.MemorySegment options, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_media_rich.invokeExact(_allocator, ptr, recipient, fileData, fileName, contentType, options, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment content, java.lang.foreign.MemorySegment priority, java.lang.foreign.MemorySegment replyToMsg, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message.invokeExact(_allocator, ptr, recipient, content, priority, replyToMsg, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message_rich + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message_rich = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message_rich", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message_rich(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment content, java.lang.foreign.MemorySegment options, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_message_rich.invokeExact(_allocator, ptr, recipient, content, options, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_presence_update + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_presence_update = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_presence_update", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_presence_update(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment status, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_presence_update.invokeExact(_allocator, ptr, recipient, status, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_read_receipt + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_read_receipt = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_read_receipt", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_read_receipt(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment messageIds, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_read_receipt.invokeExact(_allocator, ptr, recipient, messageIds, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_typing_indicator + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_typing_indicator = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_typing_indicator", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_typing_indicator(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment recipient, java.lang.foreign.MemorySegment conversationId, byte isTyping, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_send_typing_indicator.invokeExact(_allocator, ptr, recipient, conversationId, isTyping, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_level + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_level = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_level", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_level(long ptr, byte level, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_level.invokeExact(ptr, level, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_state = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_state", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_state(long ptr, byte level, byte isCharging, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_battery_state.invokeExact(ptr, level, isCharging, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_ble_transport_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_ble_transport_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_ble_transport_callback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_ble_transport_callback(long ptr, long callback, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_ble_transport_callback.invokeExact(ptr, callback, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_event_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_event_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_event_callback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_event_callback(long ptr, long callback, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_event_callback.invokeExact(ptr, callback, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_member_role + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_member_role = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_member_role", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_member_role(long ptr, java.lang.foreign.MemorySegment groupId, java.lang.foreign.MemorySegment userId, java.lang.foreign.MemorySegment role, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_member_role.invokeExact(ptr, groupId, userId, role, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_nostr_transport_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_nostr_transport_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_nostr_transport_callback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_nostr_transport_callback(long ptr, long callback, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_nostr_transport_callback.invokeExact(ptr, callback, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_relay_priority + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_relay_priority = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_relay_priority", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_relay_priority(long ptr, java.lang.foreign.MemorySegment priority, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_relay_priority.invokeExact(ptr, priority, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_reticulum_transport_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_reticulum_transport_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_reticulum_transport_callback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_reticulum_transport_callback(long ptr, long callback, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_reticulum_transport_callback.invokeExact(ptr, callback, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_telemetry_enabled + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_telemetry_enabled = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_telemetry_enabled", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_telemetry_enabled(long ptr, byte enabled, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_telemetry_enabled.invokeExact(ptr, enabled, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_wifi_direct_transport_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_wifi_direct_transport_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_wifi_direct_transport_callback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_wifi_direct_transport_callback(long ptr, long callback, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_set_wifi_direct_transport_callback.invokeExact(ptr, callback, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_should_escalate_to_wifi + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_should_escalate_to_wifi = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_should_escalate_to_wifi", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_should_escalate_to_wifi(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_should_escalate_to_wifi.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data.invokeExact(_allocator, ptr, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data_bytes + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data_bytes = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data_bytes", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data_bytes(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_sign_data_bytes.invokeExact(_allocator, ptr, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_start + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_start = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_start", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_start(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_start.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_stop + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_stop = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_stop", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_stop(long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_stop.invokeExact(ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_install_id + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_install_id = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_install_id", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_install_id(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_install_id.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_stats", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_stats(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_telemetry_stats.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_unblock_user + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_unblock_user = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_unblock_user", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_unblock_user(long ptr, java.lang.foreign.MemorySegment userId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_unblock_user.invokeExact(ptr, userId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_ack_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_ack_config = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_ack_config", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_ack_config(long ptr, java.lang.foreign.MemorySegment config, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_ack_config.invokeExact(ptr, config, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dedup_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dedup_config = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dedup_config", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dedup_config(long ptr, java.lang.foreign.MemorySegment config, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dedup_config.invokeExact(ptr, config, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dors_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dors_config = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dors_config", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dors_config(long ptr, java.lang.foreign.MemorySegment config, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_dors_config.invokeExact(ptr, config, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_relay_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_relay_config = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_relay_config", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_relay_config(long ptr, java.lang.foreign.MemorySegment config, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_relay_config.invokeExact(ptr, config, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_retry_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_retry_config = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_retry_config", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_retry_config(long ptr, java.lang.foreign.MemorySegment config, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_retry_config.invokeExact(ptr, config, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_transport_metrics + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_transport_metrics = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_transport_metrics", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_transport_metrics(long ptr, java.lang.foreign.MemorySegment transportType, java.lang.foreign.MemorySegment metrics, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_update_transport_metrics.invokeExact(ptr, transportType, metrics, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature(long ptr, java.lang.foreign.MemorySegment publicKey, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment signature, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature.invokeExact(ptr, publicKey, data, signature, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature_bytes + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature_bytes = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature_bytes", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature_bytes(long ptr, java.lang.foreign.MemorySegment publicKey, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment signature, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_verify_signature_bytes.invokeExact(ptr, publicKey, data, signature, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_get_next_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_get_next_message = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_get_next_message", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_get_next_message(java.lang.foreign.SegmentAllocator _allocator, long ptr, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_get_next_message.invokeExact(_allocator, ptr, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_message_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_message_received = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_message_received", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_message_received(long ptr, java.lang.foreign.MemorySegment senderId, java.lang.foreign.MemorySegment data, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_message_received.invokeExact(ptr, senderId, data, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_connected + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_connected = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_connected", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_connected(long ptr, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_connected.invokeExact(ptr, peerId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_disconnected + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_disconnected = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_disconnected", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_disconnected(long ptr, java.lang.foreign.MemorySegment peerId, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_peer_disconnected.invokeExact(ptr, peerId, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_status_changed", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_status_changed(long ptr, byte isConnected, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_uniffi_offline_protocol_uniffi_fn_method_offlineprotocol_wifi_direct_status_changed.invokeExact(ptr, isConnected, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_init_callback_vtable_bletransportcallback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_bletransportcallback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_init_callback_vtable_bletransportcallback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_init_callback_vtable_bletransportcallback(java.lang.foreign.MemorySegment vtable) { + try { + MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_bletransportcallback.invokeExact(vtable); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_init_callback_vtable_eventcallback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_eventcallback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_init_callback_vtable_eventcallback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_init_callback_vtable_eventcallback(java.lang.foreign.MemorySegment vtable) { + try { + MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_eventcallback.invokeExact(vtable); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_init_callback_vtable_mlsstorageprovider + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_mlsstorageprovider = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_init_callback_vtable_mlsstorageprovider", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_init_callback_vtable_mlsstorageprovider(java.lang.foreign.MemorySegment vtable) { + try { + MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_mlsstorageprovider.invokeExact(vtable); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_init_callback_vtable_nostrtransportcallback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_nostrtransportcallback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_init_callback_vtable_nostrtransportcallback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_init_callback_vtable_nostrtransportcallback(java.lang.foreign.MemorySegment vtable) { + try { + MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_nostrtransportcallback.invokeExact(vtable); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_init_callback_vtable_protocolstatestorageprovider + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_protocolstatestorageprovider = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_init_callback_vtable_protocolstatestorageprovider", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_init_callback_vtable_protocolstatestorageprovider(java.lang.foreign.MemorySegment vtable) { + try { + MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_protocolstatestorageprovider.invokeExact(vtable); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_init_callback_vtable_reticulumtransportcallback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_reticulumtransportcallback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_init_callback_vtable_reticulumtransportcallback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_init_callback_vtable_reticulumtransportcallback(java.lang.foreign.MemorySegment vtable) { + try { + MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_reticulumtransportcallback.invokeExact(vtable); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_init_callback_vtable_wifidirecttransportcallback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_wifidirecttransportcallback = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_init_callback_vtable_wifidirecttransportcallback", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS)); + + static void uniffi_offline_protocol_uniffi_fn_init_callback_vtable_wifidirecttransportcallback(java.lang.foreign.MemorySegment vtable) { + try { + MH_uniffi_offline_protocol_uniffi_fn_init_callback_vtable_wifidirecttransportcallback.invokeExact(vtable); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_func_derive_address + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_func_derive_address = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_func_derive_address", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_func_derive_address(java.lang.foreign.SegmentAllocator _allocator, java.lang.foreign.MemorySegment publicKey, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_func_derive_address.invokeExact(_allocator, publicKey, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_func_parse_invite + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_func_parse_invite = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_func_parse_invite", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_func_parse_invite(java.lang.foreign.SegmentAllocator _allocator, java.lang.foreign.MemorySegment blob, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_func_parse_invite.invokeExact(_allocator, blob, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_func_run_storage_conformance + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_func_run_storage_conformance = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_func_run_storage_conformance", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_func_run_storage_conformance(java.lang.foreign.SegmentAllocator _allocator, long storage, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_func_run_storage_conformance.invokeExact(_allocator, storage, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_fn_func_verify_identity_assertion + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_fn_func_verify_identity_assertion = findDowncallHandle("uniffi_offline_protocol_uniffi_fn_func_verify_identity_assertion", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment uniffi_offline_protocol_uniffi_fn_func_verify_identity_assertion(java.lang.foreign.SegmentAllocator _allocator, java.lang.foreign.MemorySegment assertion, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_uniffi_offline_protocol_uniffi_fn_func_verify_identity_assertion.invokeExact(_allocator, assertion, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rustbuffer_alloc + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rustbuffer_alloc = findDowncallHandle("ffi_offline_protocol_uniffi_rustbuffer_alloc", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment ffi_offline_protocol_uniffi_rustbuffer_alloc(java.lang.foreign.SegmentAllocator _allocator, long size, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_ffi_offline_protocol_uniffi_rustbuffer_alloc.invokeExact(_allocator, size, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rustbuffer_from_bytes + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rustbuffer_from_bytes = findDowncallHandle("ffi_offline_protocol_uniffi_rustbuffer_from_bytes", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, ForeignBytes.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment ffi_offline_protocol_uniffi_rustbuffer_from_bytes(java.lang.foreign.SegmentAllocator _allocator, java.lang.foreign.MemorySegment bytes, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_ffi_offline_protocol_uniffi_rustbuffer_from_bytes.invokeExact(_allocator, bytes, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rustbuffer_free + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rustbuffer_free = findDowncallHandle("ffi_offline_protocol_uniffi_rustbuffer_free", java.lang.foreign.FunctionDescriptor.ofVoid(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.ADDRESS)); + + static void ffi_offline_protocol_uniffi_rustbuffer_free(java.lang.foreign.MemorySegment buf, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_ffi_offline_protocol_uniffi_rustbuffer_free.invokeExact(buf, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rustbuffer_reserve + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rustbuffer_reserve = findDowncallHandle("ffi_offline_protocol_uniffi_rustbuffer_reserve", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment ffi_offline_protocol_uniffi_rustbuffer_reserve(java.lang.foreign.SegmentAllocator _allocator, java.lang.foreign.MemorySegment buf, long additional, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_ffi_offline_protocol_uniffi_rustbuffer_reserve.invokeExact(_allocator, buf, additional, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_u8 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_u8 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_u8", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_u8(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_u8.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_u8 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_u8 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_u8", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_u8(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_u8.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_u8 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_u8 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_u8", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_u8(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_u8.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_u8 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_u8 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_u8", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte ffi_offline_protocol_uniffi_rust_future_complete_u8(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_ffi_offline_protocol_uniffi_rust_future_complete_u8.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_i8 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_i8 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_i8", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_i8(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_i8.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_i8 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_i8 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_i8", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_i8(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_i8.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_i8 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_i8 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_i8", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_i8(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_i8.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_i8 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_i8 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_i8", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_BYTE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static byte ffi_offline_protocol_uniffi_rust_future_complete_i8(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (byte) MH_ffi_offline_protocol_uniffi_rust_future_complete_i8.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_u16 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_u16 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_u16", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_u16(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_u16.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_u16 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_u16 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_u16", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_u16(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_u16.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_u16 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_u16 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_u16", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_u16(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_u16.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_u16 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_u16 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_u16", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static short ffi_offline_protocol_uniffi_rust_future_complete_u16(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (short) MH_ffi_offline_protocol_uniffi_rust_future_complete_u16.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_i16 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_i16 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_i16", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_i16(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_i16.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_i16 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_i16 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_i16", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_i16(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_i16.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_i16 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_i16 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_i16", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_i16(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_i16.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_i16 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_i16 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_i16", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static short ffi_offline_protocol_uniffi_rust_future_complete_i16(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (short) MH_ffi_offline_protocol_uniffi_rust_future_complete_i16.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_u32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_u32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_u32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_u32(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_u32.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_u32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_u32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_u32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_u32(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_u32.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_u32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_u32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_u32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_u32(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_u32.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_u32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_u32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_u32", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static int ffi_offline_protocol_uniffi_rust_future_complete_u32(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (int) MH_ffi_offline_protocol_uniffi_rust_future_complete_u32.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_i32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_i32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_i32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_i32(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_i32.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_i32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_i32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_i32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_i32(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_i32.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_i32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_i32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_i32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_i32(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_i32.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_i32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_i32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_i32", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_INT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static int ffi_offline_protocol_uniffi_rust_future_complete_i32(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (int) MH_ffi_offline_protocol_uniffi_rust_future_complete_i32.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_u64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_u64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_u64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_u64(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_u64.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_u64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_u64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_u64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_u64(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_u64.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_u64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_u64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_u64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_u64(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_u64.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_u64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_u64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_u64", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long ffi_offline_protocol_uniffi_rust_future_complete_u64(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_ffi_offline_protocol_uniffi_rust_future_complete_u64.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_i64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_i64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_i64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_i64(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_i64.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_i64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_i64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_i64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_i64(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_i64.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_i64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_i64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_i64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_i64(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_i64.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_i64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_i64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_i64", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static long ffi_offline_protocol_uniffi_rust_future_complete_i64(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (long) MH_ffi_offline_protocol_uniffi_rust_future_complete_i64.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_f32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_f32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_f32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_f32(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_f32.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_f32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_f32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_f32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_f32(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_f32.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_f32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_f32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_f32", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_f32(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_f32.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_f32 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_f32 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_f32", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_FLOAT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static float ffi_offline_protocol_uniffi_rust_future_complete_f32(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (float) MH_ffi_offline_protocol_uniffi_rust_future_complete_f32.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_f64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_f64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_f64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_f64(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_f64.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_f64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_f64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_f64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_f64(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_f64.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_f64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_f64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_f64", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_f64(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_f64.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_f64 + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_f64 = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_f64", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_DOUBLE, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static double ffi_offline_protocol_uniffi_rust_future_complete_f64(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (double) MH_ffi_offline_protocol_uniffi_rust_future_complete_f64.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_rust_buffer + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_rust_buffer = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_rust_buffer", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_rust_buffer(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_rust_buffer.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_rust_buffer + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_rust_buffer = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_rust_buffer", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_rust_buffer(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_rust_buffer.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_rust_buffer + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_rust_buffer = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_rust_buffer", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_rust_buffer(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_rust_buffer.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_rust_buffer + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_rust_buffer = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_rust_buffer", java.lang.foreign.FunctionDescriptor.of(RustBuffer.LAYOUT, java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static java.lang.foreign.MemorySegment ffi_offline_protocol_uniffi_rust_future_complete_rust_buffer(java.lang.foreign.SegmentAllocator _allocator, long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + return (java.lang.foreign.MemorySegment) MH_ffi_offline_protocol_uniffi_rust_future_complete_rust_buffer.invokeExact(_allocator, handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_poll_void + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_poll_void = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_poll_void", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_poll_void(long handle, java.lang.foreign.MemorySegment callback, long callbackData) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_poll_void.invokeExact(handle, callback, callbackData); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_cancel_void + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_cancel_void = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_cancel_void", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_cancel_void(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_cancel_void.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_free_void + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_free_void = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_free_void", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG)); + + static void ffi_offline_protocol_uniffi_rust_future_free_void(long handle) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_free_void.invokeExact(handle); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_rust_future_complete_void + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_rust_future_complete_void = findDowncallHandle("ffi_offline_protocol_uniffi_rust_future_complete_void", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.ADDRESS)); + + static void ffi_offline_protocol_uniffi_rust_future_complete_void(long handle, java.lang.foreign.MemorySegment _uniffiOutErr) { + try { + MH_ffi_offline_protocol_uniffi_rust_future_complete_void.invokeExact(handle, _uniffiOutErr); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_func_derive_address + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_func_derive_address = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_func_derive_address", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_func_derive_address() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_func_derive_address.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_func_parse_invite + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_func_parse_invite = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_func_parse_invite", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_func_parse_invite() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_func_parse_invite.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_func_run_storage_conformance + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_func_run_storage_conformance = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_func_run_storage_conformance", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_func_run_storage_conformance() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_func_run_storage_conformance.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_func_verify_identity_assertion + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_func_verify_identity_assertion = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_func_verify_identity_assertion", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_func_verify_identity_assertion() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_func_verify_identity_assertion.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_attachment_hash + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_attachment_hash = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_attachment_hash", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_attachment_hash() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_attachment_hash.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_increment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_increment = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_increment", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_increment() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_increment.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_value + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_value = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_value", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_value() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_counter_value.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_create_doc + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_create_doc = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_create_doc", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_create_doc() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_create_doc.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_decline_attachment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_decline_attachment = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_decline_attachment", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_decline_attachment() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_decline_attachment.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_delete_doc + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_delete_doc = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_delete_doc", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_delete_doc() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_delete_doc.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_json + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_json = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_json", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_json() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_json.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_size + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_size = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_size", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_size() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_doc_size.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_export_raw + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_export_raw = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_export_raw", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_export_raw() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_export_raw.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment_from + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment_from = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment_from", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment_from() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_fetch_attachment_from.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_flush + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_flush = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_flush", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_flush() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_flush.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_flush_all + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_flush_all = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_flush_all", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_flush_all() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_flush_all.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_list_delete + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_delete = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_list_delete", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_list_delete() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_delete.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_list_docs + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_docs = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_list_docs", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_list_docs() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_docs.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_list_len + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_len = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_list_len", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_list_len() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_len.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_list_push + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_push = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_list_push", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_list_push() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_push.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_list_spaces + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_spaces = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_list_spaces", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_list_spaces() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_list_spaces.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_map_delete + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_map_delete = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_map_delete", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_map_delete() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_map_delete.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_map_get_json + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_map_get_json = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_map_get_json", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_map_get_json() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_map_get_json.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_map_set + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_map_set = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_map_set", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_map_set() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_map_set.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_provide_attachment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_provide_attachment = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_provide_attachment", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_provide_attachment() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_provide_attachment.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_doc + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_doc = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_doc", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_doc() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_doc.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_space + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_space = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_space", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_space() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_remove_space.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_set_interest + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_set_interest = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_set_interest", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_set_interest() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_set_interest.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_text_delete + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_text_delete = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_text_delete", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_text_delete() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_text_delete.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_text_insert + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_text_insert = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_text_insert", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_text_insert() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_text_insert.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_text_value + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_text_value = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_text_value", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_text_value() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_text_value.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_datastore_wipe_all + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_wipe_all = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_datastore_wipe_all", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_datastore_wipe_all() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_datastore_wipe_all.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_meshservices_discover_services + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_discover_services = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_meshservices_discover_services", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_meshservices_discover_services() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_discover_services.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_meshservices_register_service + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_register_service = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_meshservices_register_service", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_meshservices_register_service() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_register_service.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_meshservices_respond_to_service_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_respond_to_service_request = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_meshservices_respond_to_service_request", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_meshservices_respond_to_service_request() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_respond_to_service_request.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_meshservices_send_service_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_send_service_request = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_meshservices_send_service_request", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_meshservices_send_service_request() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_send_service_request.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_meshservices_unregister_service + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_unregister_service = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_meshservices_unregister_service", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_meshservices_unregister_service() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_meshservices_unregister_service.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_accept_connection_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_accept_connection_request = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_accept_connection_request", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_accept_connection_request() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_accept_connection_request.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_clear_peer_mtu + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_clear_peer_mtu = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_clear_peer_mtu", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_clear_peer_mtu() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_clear_peer_mtu.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_fallback_count + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_fallback_count = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_fallback_count", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_fallback_count() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_fallback_count.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_received = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_received", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_received() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_fragment_received.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_next_fragment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_next_fragment = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_next_fragment", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_next_fragment() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_next_fragment.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_peer_count + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_peer_count = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_peer_count", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_peer_count() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_get_peer_count.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_discovered + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_discovered = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_discovered", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_discovered() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_discovered.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_lost + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_lost = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_lost", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_lost() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_peer_lost.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_recipient_not_among_peers_count + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_recipient_not_among_peers_count = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_recipient_not_among_peers_count", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_recipient_not_among_peers_count() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_recipient_not_among_peers_count.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_return_fragment + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_return_fragment = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_return_fragment", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_return_fragment() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_return_fragment.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_set_peer_mtu + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_set_peer_mtu = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_set_peer_mtu", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_set_peer_mtu() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_set_peer_mtu.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_status_changed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_status_changed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_status_changed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_undersized_mtu_reports + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_undersized_mtu_reports = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_undersized_mtu_reports", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_undersized_mtu_reports() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_ble_undersized_mtu_reports.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_block_user + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_block_user = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_block_user", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_block_user() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_block_user.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_connection_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_connection_request = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_connection_request", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_connection_request() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_connection_request.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_file_transfer + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_file_transfer = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_file_transfer", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_file_transfer() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_cancel_file_transfer.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_close_file_stores + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_close_file_stores = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_close_file_stores", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_close_file_stores() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_close_file_stores.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_group = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_group", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_group() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_group.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_invite + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_invite = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_invite", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_invite() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_create_invite.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_derive_user_id_from_public_key + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_derive_user_id_from_public_key = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_derive_user_id_from_public_key", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_derive_user_id_from_public_key() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_derive_user_id_from_public_key.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_disable_telemetry + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_disable_telemetry = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_disable_telemetry", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_disable_telemetry() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_disable_telemetry.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_emit_test_event + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_emit_test_event = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_emit_test_event", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_emit_test_event() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_emit_test_event.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_enable_telemetry + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_enable_telemetry = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_enable_telemetry", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_enable_telemetry() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_enable_telemetry.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_end_telemetry_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_end_telemetry_session = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_end_telemetry_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_end_telemetry_session() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_end_telemetry_session.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_erase_custody + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_erase_custody = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_erase_custody", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_erase_custody() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_erase_custody.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_establish_secure_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_establish_secure_session = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_establish_secure_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_establish_secure_session() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_establish_secure_session.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_finalize_file + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_finalize_file = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_finalize_file", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_finalize_file() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_finalize_file.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry_blocking + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry_blocking = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry_blocking", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry_blocking() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_flush_telemetry_blocking.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_force_transport + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_force_transport = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_force_transport", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_force_transport() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_force_transport.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message_to_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message_to_group = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message_to_group", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message_to_group() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_forward_message_to_group.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_gateway_address_declaration + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_gateway_address_declaration = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_gateway_address_declaration", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_gateway_address_declaration() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_gateway_address_declaration.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_active_transports + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_active_transports = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_active_transports", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_active_transports() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_active_transports.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_battery_level + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_battery_level = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_battery_level", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_battery_level() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_battery_level.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_blocked_users + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_blocked_users = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_blocked_users", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_blocked_users() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_blocked_users.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_custody_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_custody_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_custody_stats", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_custody_stats() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_custody_stats.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dedup_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dedup_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dedup_stats", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dedup_stats() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dedup_stats.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_delivery_success_rate + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_delivery_success_rate = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_delivery_success_rate", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_delivery_success_rate() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_delivery_success_rate.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dors_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dors_config = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dors_config", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dors_config() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_dors_config.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_establishment_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_establishment_state = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_establishment_state", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_establishment_state() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_establishment_state.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_file_progress + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_file_progress = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_file_progress", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_file_progress() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_file_progress.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_info + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_info = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_info", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_info() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_info.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_roles + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_roles = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_roles", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_roles() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_group_roles.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_identity_public_key + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_identity_public_key = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_identity_public_key", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_identity_public_key() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_identity_public_key.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_is_charging + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_is_charging = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_is_charging", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_is_charging() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_is_charging.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_hops + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_hops = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_hops", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_hops() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_hops.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_latency + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_latency = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_latency", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_latency() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_median_latency.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_member_role + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_member_role = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_member_role", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_member_role() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_member_role.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_stats", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_stats() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_stats.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_tunables + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_tunables = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_tunables", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_tunables() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_mesh_relay_tunables.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_message_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_message_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_message_stats", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_message_stats() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_message_stats.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_pending_ack_count + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_pending_ack_count = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_pending_ack_count", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_pending_ack_count() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_pending_ack_count.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_config = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_config", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_config() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_config.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_priority + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_priority = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_priority", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_priority() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_relay_priority.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_retry_queue_size + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_retry_queue_size = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_retry_queue_size", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_retry_queue_size() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_retry_queue_size.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_state = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_state", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_state() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_state.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_topology + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_topology = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_topology", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_topology() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_topology.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_transport_metrics + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_transport_metrics = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_transport_metrics", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_transport_metrics() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_get_transport_metrics.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_relay_sync_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_relay_sync_state = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_relay_sync_state", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_relay_sync_state() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_relay_sync_state.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_rich_readiness + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_rich_readiness = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_rich_readiness", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_rich_readiness() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_group_rich_readiness.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_has_pending_key_package + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_has_pending_key_package = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_has_pending_key_package", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_has_pending_key_package() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_has_pending_key_package.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_identity_assertion + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_identity_assertion = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_identity_assertion", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_identity_assertion() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_identity_assertion.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls_with_file_stores + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls_with_file_stores = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls_with_file_stores", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls_with_file_stores() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_initialize_mls_with_file_stores.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declaration_refused + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declaration_refused = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declaration_refused", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declaration_refused() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declaration_refused.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declared + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declared = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declared", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declared() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_address_declared.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_confirm_sent + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_confirm_sent = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_confirm_sent", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_confirm_sent() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_confirm_sent.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_get_next_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_get_next_message = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_get_next_message", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_get_next_message() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_get_next_message.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_group_report_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_group_report_received = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_group_report_received", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_group_report_received() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_group_report_received.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_message_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_message_received = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_message_received", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_message_received() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_message_received.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_peer_presence + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_peer_presence = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_peer_presence", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_peer_presence() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_peer_presence.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_presence_watchlist + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_presence_watchlist = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_presence_watchlist", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_presence_watchlist() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_presence_watchlist.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_relay_capabilities + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_relay_capabilities = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_relay_capabilities", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_relay_capabilities() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_relay_capabilities.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed_with_reason + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed_with_reason = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed_with_reason", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed_with_reason() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_send_failed_with_reason.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_status_changed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_status_changed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_internet_status_changed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_invite_to_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_invite_to_group = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_invite_to_group", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_invite_to_group() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_invite_to_group.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_mls_initialized + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_mls_initialized = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_mls_initialized", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_mls_initialized() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_mls_initialized.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_relay + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_relay = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_relay", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_relay() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_relay.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_user_blocked + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_user_blocked = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_user_blocked", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_user_blocked() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_is_user_blocked.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_leave_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_leave_group = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_leave_group", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_leave_group() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_leave_group.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_list_groups + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_list_groups = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_list_groups", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_list_groups() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_list_groups.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_local_address + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_local_address = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_local_address", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_local_address() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_local_address.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_clear_pending_welcome + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_clear_pending_welcome = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_clear_pending_welcome", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_clear_pending_welcome() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_clear_pending_welcome.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_create_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_create_session = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_create_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_create_session() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_create_session.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt_from_user + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt_from_user = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt_from_user", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt_from_user() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_decrypt_from_user.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_delete_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_delete_session = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_delete_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_delete_session() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_delete_session.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_encrypt_for_user + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_encrypt_for_user = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_encrypt_for_user", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_encrypt_for_user() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_encrypt_for_user.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_generate_key_package + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_generate_key_package = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_generate_key_package", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_generate_key_package() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_generate_key_package.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_or_create_key_package + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_or_create_key_package = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_or_create_key_package", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_or_create_key_package() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_or_create_key_package.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_key_packages + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_key_packages = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_key_packages", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_key_packages() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_key_packages.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_welcome + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_welcome = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_welcome", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_welcome() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_get_pending_welcome.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_has_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_has_session = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_has_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_has_session() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_has_session.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_import_key_package + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_import_key_package = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_import_key_package", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_import_key_package() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_import_key_package.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_join_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_join_session = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_join_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_join_session() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_join_session.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_list_sessions + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_list_sessions = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_list_sessions", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_list_sessions() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_list_sessions.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_mark_key_package_synced + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_mark_key_package_synced = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_mark_key_package_synced", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_mark_key_package_synced() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_mark_key_package_synced.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_process_welcome + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_process_welcome = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_process_welcome", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_process_welcome() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_mls_process_welcome.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_confirm_sent + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_confirm_sent = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_confirm_sent", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_confirm_sent() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_confirm_sent.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_message = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_message", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_message() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_message.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_query + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_query = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_query", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_query() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_next_query.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_public_key + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_public_key = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_public_key", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_public_key() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_public_key.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_subscription_filter + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_subscription_filter = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_subscription_filter", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_subscription_filter() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_get_subscription_filter.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received_at + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received_at = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received_at", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received_at() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_message_received_at.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_completed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_completed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_completed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_completed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_completed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_event_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_event_received = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_event_received", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_event_received() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_query_event_received.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed_with_reason + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed_with_reason = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed_with_reason", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed_with_reason() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_send_failed_with_reason.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_status_changed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_status_changed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_nostr_status_changed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_notify_app_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_notify_app_state = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_notify_app_state", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_notify_app_state() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_notify_app_state.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_pause + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_pause = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_pause", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_pause() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_pause.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_poll_event + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_poll_event = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_poll_event", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_poll_event() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_poll_event.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process_file_chunk + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process_file_chunk = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process_file_chunk", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process_file_chunk() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_process_file_chunk.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_protocol_lock_diagnostics + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_protocol_lock_diagnostics = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_protocol_lock_diagnostics", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_protocol_lock_diagnostics() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_protocol_lock_diagnostics.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_receive_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_receive_message = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_receive_message", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_receive_message() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_receive_message.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reject_connection_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reject_connection_request = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reject_connection_request", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reject_connection_request() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reject_connection_request.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rekey_session + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rekey_session = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rekey_session", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rekey_session() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rekey_session.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_release_transport_lock + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_release_transport_lock = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_release_transport_lock", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_release_transport_lock() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_release_transport_lock.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_from_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_from_group = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_from_group", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_from_group() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_from_group.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_transport + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_transport = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_transport", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_transport() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_remove_transport.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rename_group + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rename_group = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rename_group", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rename_group() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_rename_group.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_request_group_relay_registration + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_request_group_relay_registration = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_request_group_relay_registration", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_request_group_relay_registration() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_request_group_relay_registration.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resolve_username + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resolve_username = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resolve_username", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resolve_username() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resolve_username.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resume + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resume = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resume", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resume() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_resume.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declaration_refused + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declaration_refused = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declaration_refused", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declaration_refused() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declaration_refused.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declared + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declared = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declared", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declared() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_address_declared.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_confirm_sent + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_confirm_sent = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_confirm_sent", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_confirm_sent() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_confirm_sent.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_gateway_capabilities + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_gateway_capabilities = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_gateway_capabilities", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_gateway_capabilities() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_gateway_capabilities.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_get_next_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_get_next_message = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_get_next_message", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_get_next_message() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_get_next_message.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_message_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_message_received = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_message_received", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_message_received() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_message_received.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_peer_presence + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_peer_presence = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_peer_presence", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_peer_presence() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_peer_presence.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_presence_watchlist + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_presence_watchlist = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_presence_watchlist", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_presence_watchlist() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_presence_watchlist.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed_with_reason + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed_with_reason = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed_with_reason", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed_with_reason() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_send_failed_with_reason.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_status_changed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_status_changed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_reticulum_status_changed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_connection_request + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_connection_request = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_connection_request", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_connection_request() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_connection_request.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_file + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_file = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_file", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_file() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_file.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_group_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_group_message = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_group_message", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_group_message() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_group_message.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media_rich + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media_rich = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media_rich", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media_rich() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_media_rich.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message_rich + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message_rich = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message_rich", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message_rich() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_message_rich.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_presence_update + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_presence_update = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_presence_update", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_presence_update() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_presence_update.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_read_receipt + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_read_receipt = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_read_receipt", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_read_receipt() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_read_receipt.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_typing_indicator + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_typing_indicator = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_typing_indicator", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_typing_indicator() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_send_typing_indicator.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_level + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_level = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_level", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_level() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_level.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_state + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_state = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_state", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_state() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_battery_state.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_ble_transport_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_ble_transport_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_ble_transport_callback", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_ble_transport_callback() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_ble_transport_callback.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_event_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_event_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_event_callback", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_event_callback() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_event_callback.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_member_role + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_member_role = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_member_role", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_member_role() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_member_role.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_nostr_transport_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_nostr_transport_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_nostr_transport_callback", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_nostr_transport_callback() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_nostr_transport_callback.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_relay_priority + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_relay_priority = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_relay_priority", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_relay_priority() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_relay_priority.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_reticulum_transport_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_reticulum_transport_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_reticulum_transport_callback", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_reticulum_transport_callback() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_reticulum_transport_callback.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_telemetry_enabled + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_telemetry_enabled = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_telemetry_enabled", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_telemetry_enabled() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_telemetry_enabled.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_wifi_direct_transport_callback + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_wifi_direct_transport_callback = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_wifi_direct_transport_callback", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_wifi_direct_transport_callback() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_set_wifi_direct_transport_callback.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_should_escalate_to_wifi + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_should_escalate_to_wifi = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_should_escalate_to_wifi", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_should_escalate_to_wifi() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_should_escalate_to_wifi.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data_bytes + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data_bytes = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data_bytes", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data_bytes() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_sign_data_bytes.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_start + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_start = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_start", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_start() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_start.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_stop + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_stop = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_stop", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_stop() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_stop.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_install_id + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_install_id = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_install_id", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_install_id() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_install_id.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_stats + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_stats = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_stats", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_stats() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_telemetry_stats.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_unblock_user + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_unblock_user = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_unblock_user", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_unblock_user() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_unblock_user.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_ack_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_ack_config = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_ack_config", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_ack_config() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_ack_config.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dedup_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dedup_config = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dedup_config", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dedup_config() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dedup_config.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dors_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dors_config = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dors_config", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dors_config() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_dors_config.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_relay_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_relay_config = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_relay_config", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_relay_config() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_relay_config.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_retry_config + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_retry_config = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_retry_config", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_retry_config() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_retry_config.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_transport_metrics + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_transport_metrics = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_transport_metrics", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_transport_metrics() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_update_transport_metrics.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature_bytes + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature_bytes = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature_bytes", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature_bytes() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_verify_signature_bytes.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_get_next_message + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_get_next_message = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_get_next_message", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_get_next_message() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_get_next_message.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_message_received + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_message_received = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_message_received", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_message_received() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_message_received.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_connected + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_connected = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_connected", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_connected() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_connected.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_disconnected + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_disconnected = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_disconnected", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_disconnected() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_peer_disconnected.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_status_changed + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_status_changed = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_status_changed", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_status_changed() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_offlineprotocol_wifi_direct_status_changed.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_constructor_datastore_new + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_constructor_datastore_new = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_constructor_datastore_new", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_constructor_datastore_new() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_constructor_datastore_new.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_constructor_datastore_with_storage + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_constructor_datastore_with_storage = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_constructor_datastore_with_storage", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_constructor_datastore_with_storage() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_constructor_datastore_with_storage.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_constructor_meshservices_new + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_constructor_meshservices_new = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_constructor_meshservices_new", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_constructor_meshservices_new() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_constructor_meshservices_new.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_constructor_offlineprotocol_new + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_constructor_offlineprotocol_new = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_constructor_offlineprotocol_new", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_constructor_offlineprotocol_new() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_constructor_offlineprotocol_new.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_bletransportcallback_on_fragments_available + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_bletransportcallback_on_fragments_available = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_bletransportcallback_on_fragments_available", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_bletransportcallback_on_fragments_available() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_bletransportcallback_on_fragments_available.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_eventcallback_on_event + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_eventcallback_on_event = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_eventcallback_on_event", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_eventcallback_on_event() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_eventcallback_on_event.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_store + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_store = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_store", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_store() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_store.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_load + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_load = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_load", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_load() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_load.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_delete + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_delete = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_delete", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_delete() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_delete.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_list_keys + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_list_keys = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_list_keys", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_list_keys() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_mlsstorageprovider_list_keys.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_nostrtransportcallback_on_messages_available + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_nostrtransportcallback_on_messages_available = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_nostrtransportcallback_on_messages_available", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_nostrtransportcallback_on_messages_available() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_nostrtransportcallback_on_messages_available.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_store + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_store = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_store", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_store() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_store.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_load + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_load = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_load", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_load() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_load.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_delete + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_delete = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_delete", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_delete() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_delete.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_list_keys + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_list_keys = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_list_keys", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_list_keys() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_protocolstatestorageprovider_list_keys.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_reticulumtransportcallback_on_messages_available + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_reticulumtransportcallback_on_messages_available = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_reticulumtransportcallback_on_messages_available", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_reticulumtransportcallback_on_messages_available() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_reticulumtransportcallback_on_messages_available.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // uniffi_offline_protocol_uniffi_checksum_method_wifidirecttransportcallback_on_messages_available + private static final java.lang.invoke.MethodHandle MH_uniffi_offline_protocol_uniffi_checksum_method_wifidirecttransportcallback_on_messages_available = findDowncallHandle("uniffi_offline_protocol_uniffi_checksum_method_wifidirecttransportcallback_on_messages_available", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_SHORT)); + + static short uniffi_offline_protocol_uniffi_checksum_method_wifidirecttransportcallback_on_messages_available() { + try { + return (short) MH_uniffi_offline_protocol_uniffi_checksum_method_wifidirecttransportcallback_on_messages_available.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + // ffi_offline_protocol_uniffi_uniffi_contract_version + private static final java.lang.invoke.MethodHandle MH_ffi_offline_protocol_uniffi_uniffi_contract_version = findDowncallHandle("ffi_offline_protocol_uniffi_uniffi_contract_version", java.lang.foreign.FunctionDescriptor.of(java.lang.foreign.ValueLayout.JAVA_INT)); + + static int ffi_offline_protocol_uniffi_uniffi_contract_version() { + try { + return (int) MH_ffi_offline_protocol_uniffi_uniffi_contract_version.invokeExact(); + } catch (Throwable _ex) { throw new AssertionError("invokeExact failed", _ex); } + } + + + + // Integrity checks and initialization must happen after all MethodHandle fields + // are initialized (static fields are initialized in textual order in Java). + static { + NamespaceLibrary.uniffiCheckContractApiVersion(); + NamespaceLibrary.uniffiCheckApiChecksums(); + + CLEANER = UniffiCleaner.create(); + UniffiCallbackInterfaceBleTransportCallback.INSTANCE.register(); + UniffiCallbackInterfaceEventCallback.INSTANCE.register(); + UniffiCallbackInterfaceMlsStorageProvider.INSTANCE.register(); + UniffiCallbackInterfaceNostrTransportCallback.INSTANCE.register(); + UniffiCallbackInterfaceProtocolStateStorageProvider.INSTANCE.register(); + UniffiCallbackInterfaceReticulumTransportCallback.INSTANCE.register(); + UniffiCallbackInterfaceWifiDirectTransportCallback.INSTANCE.register(); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiNullRustCallStatusErrorHandler.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiNullRustCallStatusErrorHandler.java new file mode 100644 index 00000000..a2e69398 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiNullRustCallStatusErrorHandler.java @@ -0,0 +1,12 @@ +package com.offlineprotocol.sdk; + + +// UniffiRustCallStatusErrorHandler implementation for times when we don't expect a CALL_ERROR +class UniffiNullRustCallStatusErrorHandler implements UniffiRustCallStatusErrorHandler { + @Override + public InternalException lift(java.lang.foreign.MemorySegment errorBuf) { + RustBuffer.free(errorBuf); + return new InternalException("Unexpected CALL_ERROR"); + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustCallStatus.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustCallStatus.java new file mode 100644 index 00000000..f96f79a8 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustCallStatus.java @@ -0,0 +1,73 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiRustCallStatus { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.JAVA_BYTE.withName("code"), + java.lang.foreign.MemoryLayout.paddingLayout(7), // 7 bytes padding for alignment before RustBuffer + RustBuffer.LAYOUT.withName("error_buf") + ); + + private static final long OFFSET_CODE = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("code")); + private static final long OFFSET_ERROR_BUF = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("error_buf")); + + public static final byte UNIFFI_CALL_SUCCESS = 0; + public static final byte UNIFFI_CALL_ERROR = 1; + public static final byte UNIFFI_CALL_UNEXPECTED_ERROR = 2; + + private UniffiRustCallStatus() {} + + public static byte getCode(java.lang.foreign.MemorySegment seg) { + return seg.get(java.lang.foreign.ValueLayout.JAVA_BYTE, OFFSET_CODE); + } + + public static void setCode(java.lang.foreign.MemorySegment seg, byte value) { + seg.set(java.lang.foreign.ValueLayout.JAVA_BYTE, OFFSET_CODE, value); + } + + public static java.lang.foreign.MemorySegment getErrorBuf(java.lang.foreign.MemorySegment seg) { + return seg.asSlice(OFFSET_ERROR_BUF, RustBuffer.LAYOUT.byteSize()); + } + + public static void setErrorBuf(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment errorBuf) { + java.lang.foreign.MemorySegment.copy(errorBuf, 0, seg, OFFSET_ERROR_BUF, RustBuffer.LAYOUT.byteSize()); + } + + public static boolean isSuccess(java.lang.foreign.MemorySegment seg) { + return getCode(seg) == UNIFFI_CALL_SUCCESS; + } + + public static boolean isError(java.lang.foreign.MemorySegment seg) { + return getCode(seg) == UNIFFI_CALL_ERROR; + } + + public static boolean isPanic(java.lang.foreign.MemorySegment seg) { + return getCode(seg) == UNIFFI_CALL_UNEXPECTED_ERROR; + } + + /** + * Allocate a new RustCallStatus in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } + + // Slab allocator for RustCallStatus segments used by async callback error handling. + // See UniffiSlabAllocator for the design rationale. + private static final UniffiSlabAllocator STATUS_ALLOCATOR = new UniffiSlabAllocator(LAYOUT, 1024); + + /** + * Create a RustCallStatus with the given code and error buffer. + * Used by async callback interface error handling. + */ + public static java.lang.foreign.MemorySegment create(byte code, java.lang.foreign.MemorySegment errorBuf) { + java.lang.foreign.MemorySegment seg = STATUS_ALLOCATOR.allocate(LAYOUT); + seg.fill((byte) 0); + setCode(seg, code); + setErrorBuf(seg, errorBuf); + return seg; + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustCallStatusErrorHandler.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustCallStatusErrorHandler.java new file mode 100644 index 00000000..435d2212 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustCallStatusErrorHandler.java @@ -0,0 +1,7 @@ +package com.offlineprotocol.sdk; + + +public interface UniffiRustCallStatusErrorHandler { + E lift(java.lang.foreign.MemorySegment errorBuf); +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustFutureContinuationCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustFutureContinuationCallback.java new file mode 100644 index 00000000..0fc61da2 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiRustFutureContinuationCallback.java @@ -0,0 +1,26 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiRustFutureContinuationCallback { + public static final java.lang.foreign.FunctionDescriptor DESCRIPTOR = java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.JAVA_LONG, java.lang.foreign.ValueLayout.JAVA_BYTE); + + @FunctionalInterface + public interface Fn { + void callback(long data,byte pollResult); + } + + public static java.lang.foreign.MemorySegment toUpcallStub(Fn fn, java.lang.foreign.Arena arena) { + try { + java.lang.invoke.MethodHandle handle = java.lang.invoke.MethodHandles.lookup() + .findVirtual(Fn.class, "callback", java.lang.invoke.MethodType.methodType( + void.class, + long.class, + byte.class + )) + .bindTo(fn); + return java.lang.foreign.Linker.nativeLinker().upcallStub(handle, DESCRIPTOR, arena); + } catch (NoSuchMethodException | IllegalAccessException e) { + throw new AssertionError("Failed to create upcall stub", e); + } + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiSlabAllocator.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiSlabAllocator.java new file mode 100644 index 00000000..d71ab4f3 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiSlabAllocator.java @@ -0,0 +1,53 @@ +package com.offlineprotocol.sdk; + + +// Thread-local slab allocator for short-lived native memory segments. +// +// Several FFM code paths need to allocate small struct-sized segments (RustBuffer +// at 24 bytes, RustCallStatus at 32 bytes) that are consumed immediately and never +// referenced again. +// +// Alternatives considered: +// - Arena.global(): zero overhead but leaks permanently. At high call rates this +// adds up fast (e.g. 100k calls × 24-32 bytes = 2.4-3.2 MB never reclaimed). +// - Arena.ofAuto() per call: correct but creates a new Arena + PhantomReference +// per call, adding ~50-100ns of GC pressure to every call. +// - Thread-local reusable segment: zero overhead but causes SIGABRT - the FFM +// runtime retains internal references to allocator-provided segments, so reusing +// the same segment across calls corrupts FFM's internal state. +// +// This slab approach: allocate a batch of slots from one Arena.ofAuto(), then hand +// out slices. Each call gets a unique slice (avoiding the FFM reuse crash). When the +// slab is exhausted, a new one is allocated and the old one becomes GC-eligible once +// all its slices are consumed (which is immediate - callers read struct fields before +// the next call). Amortized cost: one Arena + one native malloc per `slots` calls. +class UniffiSlabAllocator implements java.lang.foreign.SegmentAllocator { + private final long slabBytes; + private final long alignment; + private final ThreadLocal slab; + private final ThreadLocal offset; + + UniffiSlabAllocator(java.lang.foreign.MemoryLayout layout, long slots) { + this.slabBytes = layout.byteSize() * slots; + this.alignment = layout.byteAlignment(); + this.slab = ThreadLocal.withInitial(() -> + java.lang.foreign.Arena.ofAuto().allocate(this.slabBytes, this.alignment) + ); + this.offset = ThreadLocal.withInitial(() -> new long[]{0}); + } + + @Override + public java.lang.foreign.MemorySegment allocate(long byteSize, long byteAlignment) { + long[] off = this.offset.get(); + java.lang.foreign.MemorySegment s = this.slab.get(); + if (off[0] + byteSize > s.byteSize()) { + s = java.lang.foreign.Arena.ofAuto().allocate(this.slabBytes, this.alignment); + this.slab.set(s); + off[0] = 0; + } + java.lang.foreign.MemorySegment result = s.asSlice(off[0], byteSize); + off[0] += byteSize; + return result; + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceBleTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceBleTransportCallback.java new file mode 100644 index 00000000..efa5139e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceBleTransportCallback.java @@ -0,0 +1,48 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiVTableCallbackInterfaceBleTransportCallback { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiFree"), + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiClone"), + java.lang.foreign.ValueLayout.ADDRESS.withName("onFragmentsAvailable") + ); + + private static final long OFFSET_uniffiFree = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiFree")); + + private static final long OFFSET_uniffiClone = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiClone")); + + private static final long OFFSET_onFragmentsAvailable = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("onFragmentsAvailable")); + + private UniffiVTableCallbackInterfaceBleTransportCallback() {} + public static java.lang.foreign.MemorySegment getuniffiFree(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree); + } + + public static void setuniffiFree(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree, value); + } + public static java.lang.foreign.MemorySegment getuniffiClone(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone); + } + + public static void setuniffiClone(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone, value); + } + public static java.lang.foreign.MemorySegment getonFragmentsAvailable(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onFragmentsAvailable); + } + + public static void setonFragmentsAvailable(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onFragmentsAvailable, value); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceEventCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceEventCallback.java new file mode 100644 index 00000000..a2e52147 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceEventCallback.java @@ -0,0 +1,48 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiVTableCallbackInterfaceEventCallback { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiFree"), + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiClone"), + java.lang.foreign.ValueLayout.ADDRESS.withName("onEvent") + ); + + private static final long OFFSET_uniffiFree = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiFree")); + + private static final long OFFSET_uniffiClone = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiClone")); + + private static final long OFFSET_onEvent = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("onEvent")); + + private UniffiVTableCallbackInterfaceEventCallback() {} + public static java.lang.foreign.MemorySegment getuniffiFree(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree); + } + + public static void setuniffiFree(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree, value); + } + public static java.lang.foreign.MemorySegment getuniffiClone(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone); + } + + public static void setuniffiClone(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone, value); + } + public static java.lang.foreign.MemorySegment getonEvent(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onEvent); + } + + public static void setonEvent(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onEvent, value); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceMlsStorageProvider.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceMlsStorageProvider.java new file mode 100644 index 00000000..996851c4 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceMlsStorageProvider.java @@ -0,0 +1,78 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiVTableCallbackInterfaceMlsStorageProvider { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiFree"), + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiClone"), + java.lang.foreign.ValueLayout.ADDRESS.withName("store"), + java.lang.foreign.ValueLayout.ADDRESS.withName("load"), + java.lang.foreign.ValueLayout.ADDRESS.withName("delete"), + java.lang.foreign.ValueLayout.ADDRESS.withName("listKeys") + ); + + private static final long OFFSET_uniffiFree = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiFree")); + + private static final long OFFSET_uniffiClone = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiClone")); + + private static final long OFFSET_store = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("store")); + + private static final long OFFSET_load = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("load")); + + private static final long OFFSET_delete = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("delete")); + + private static final long OFFSET_listKeys = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("listKeys")); + + private UniffiVTableCallbackInterfaceMlsStorageProvider() {} + public static java.lang.foreign.MemorySegment getuniffiFree(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree); + } + + public static void setuniffiFree(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree, value); + } + public static java.lang.foreign.MemorySegment getuniffiClone(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone); + } + + public static void setuniffiClone(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone, value); + } + public static java.lang.foreign.MemorySegment getstore(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_store); + } + + public static void setstore(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_store, value); + } + public static java.lang.foreign.MemorySegment getload(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_load); + } + + public static void setload(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_load, value); + } + public static java.lang.foreign.MemorySegment getdelete(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_delete); + } + + public static void setdelete(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_delete, value); + } + public static java.lang.foreign.MemorySegment getlistKeys(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_listKeys); + } + + public static void setlistKeys(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_listKeys, value); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceNostrTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceNostrTransportCallback.java new file mode 100644 index 00000000..ba0df9fa --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceNostrTransportCallback.java @@ -0,0 +1,48 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiVTableCallbackInterfaceNostrTransportCallback { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiFree"), + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiClone"), + java.lang.foreign.ValueLayout.ADDRESS.withName("onMessagesAvailable") + ); + + private static final long OFFSET_uniffiFree = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiFree")); + + private static final long OFFSET_uniffiClone = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiClone")); + + private static final long OFFSET_onMessagesAvailable = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("onMessagesAvailable")); + + private UniffiVTableCallbackInterfaceNostrTransportCallback() {} + public static java.lang.foreign.MemorySegment getuniffiFree(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree); + } + + public static void setuniffiFree(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree, value); + } + public static java.lang.foreign.MemorySegment getuniffiClone(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone); + } + + public static void setuniffiClone(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone, value); + } + public static java.lang.foreign.MemorySegment getonMessagesAvailable(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onMessagesAvailable); + } + + public static void setonMessagesAvailable(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onMessagesAvailable, value); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceProtocolStateStorageProvider.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceProtocolStateStorageProvider.java new file mode 100644 index 00000000..3728d96c --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceProtocolStateStorageProvider.java @@ -0,0 +1,78 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiVTableCallbackInterfaceProtocolStateStorageProvider { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiFree"), + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiClone"), + java.lang.foreign.ValueLayout.ADDRESS.withName("store"), + java.lang.foreign.ValueLayout.ADDRESS.withName("load"), + java.lang.foreign.ValueLayout.ADDRESS.withName("delete"), + java.lang.foreign.ValueLayout.ADDRESS.withName("listKeys") + ); + + private static final long OFFSET_uniffiFree = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiFree")); + + private static final long OFFSET_uniffiClone = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiClone")); + + private static final long OFFSET_store = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("store")); + + private static final long OFFSET_load = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("load")); + + private static final long OFFSET_delete = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("delete")); + + private static final long OFFSET_listKeys = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("listKeys")); + + private UniffiVTableCallbackInterfaceProtocolStateStorageProvider() {} + public static java.lang.foreign.MemorySegment getuniffiFree(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree); + } + + public static void setuniffiFree(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree, value); + } + public static java.lang.foreign.MemorySegment getuniffiClone(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone); + } + + public static void setuniffiClone(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone, value); + } + public static java.lang.foreign.MemorySegment getstore(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_store); + } + + public static void setstore(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_store, value); + } + public static java.lang.foreign.MemorySegment getload(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_load); + } + + public static void setload(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_load, value); + } + public static java.lang.foreign.MemorySegment getdelete(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_delete); + } + + public static void setdelete(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_delete, value); + } + public static java.lang.foreign.MemorySegment getlistKeys(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_listKeys); + } + + public static void setlistKeys(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_listKeys, value); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceReticulumTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceReticulumTransportCallback.java new file mode 100644 index 00000000..efb8a648 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceReticulumTransportCallback.java @@ -0,0 +1,48 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiVTableCallbackInterfaceReticulumTransportCallback { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiFree"), + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiClone"), + java.lang.foreign.ValueLayout.ADDRESS.withName("onMessagesAvailable") + ); + + private static final long OFFSET_uniffiFree = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiFree")); + + private static final long OFFSET_uniffiClone = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiClone")); + + private static final long OFFSET_onMessagesAvailable = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("onMessagesAvailable")); + + private UniffiVTableCallbackInterfaceReticulumTransportCallback() {} + public static java.lang.foreign.MemorySegment getuniffiFree(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree); + } + + public static void setuniffiFree(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree, value); + } + public static java.lang.foreign.MemorySegment getuniffiClone(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone); + } + + public static void setuniffiClone(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone, value); + } + public static java.lang.foreign.MemorySegment getonMessagesAvailable(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onMessagesAvailable); + } + + public static void setonMessagesAvailable(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onMessagesAvailable, value); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceWifiDirectTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceWifiDirectTransportCallback.java new file mode 100644 index 00000000..e63e6592 --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiVTableCallbackInterfaceWifiDirectTransportCallback.java @@ -0,0 +1,49 @@ +package com.offlineprotocol.sdk; + + +public final class UniffiVTableCallbackInterfaceWifiDirectTransportCallback { + public static final java.lang.foreign.StructLayout LAYOUT = java.lang.foreign.MemoryLayout.structLayout( + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiFree"), + java.lang.foreign.ValueLayout.ADDRESS.withName("uniffiClone"), + java.lang.foreign.ValueLayout.ADDRESS.withName("onMessagesAvailable") + ); + + private static final long OFFSET_uniffiFree = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiFree")); + + private static final long OFFSET_uniffiClone = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("uniffiClone")); + + private static final long OFFSET_onMessagesAvailable = LAYOUT.byteOffset(java.lang.foreign.MemoryLayout.PathElement.groupElement("onMessagesAvailable")); + + private UniffiVTableCallbackInterfaceWifiDirectTransportCallback() {} + public static java.lang.foreign.MemorySegment getuniffiFree(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree); + } + + public static void setuniffiFree(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiFree, value); + } + public static java.lang.foreign.MemorySegment getuniffiClone(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone); + } + + public static void setuniffiClone(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_uniffiClone, value); + } + public static java.lang.foreign.MemorySegment getonMessagesAvailable(java.lang.foreign.MemorySegment seg) { + return (java.lang.foreign.MemorySegment) seg.get(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onMessagesAvailable); + } + + public static void setonMessagesAvailable(java.lang.foreign.MemorySegment seg, java.lang.foreign.MemorySegment value) { + seg.set(java.lang.foreign.ValueLayout.ADDRESS_UNALIGNED, OFFSET_onMessagesAvailable, value); + } + + /** + * Allocate a new instance in the given arena. + */ + public static java.lang.foreign.MemorySegment allocate(java.lang.foreign.SegmentAllocator allocator) { + java.lang.foreign.MemorySegment seg = allocator.allocate(LAYOUT); + seg.fill((byte) 0); + return seg; + } +} + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiWithHandle.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiWithHandle.java new file mode 100644 index 00000000..6922e33e --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/UniffiWithHandle.java @@ -0,0 +1,12 @@ +package com.offlineprotocol.sdk; + + +// Marker class for constructors that accept a raw handle. +// This disambiguates constructor signatures when an interface has both +// a regular constructor and one accepting an FFI handle. +public class UniffiWithHandle { + // Private constructor to prevent instantiation + private UniffiWithHandle() {} + + public static final UniffiWithHandle INSTANCE = new UniffiWithHandle(); +} diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/WifiDirectMessage.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/WifiDirectMessage.java new file mode 100644 index 00000000..fde145de --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/WifiDirectMessage.java @@ -0,0 +1,61 @@ +package com.offlineprotocol.sdk; + +public class WifiDirectMessage { + private java.lang.String recipientId; + private java.util.List data; + + public WifiDirectMessage( + java.lang.String recipientId, + java.util.List data + ) { + + this.recipientId = recipientId; + + this.data = data; + } + + public java.lang.String recipientId() { + return this.recipientId; + } + + public java.util.List data() { + return this.data; + } + public void setRecipientId(java.lang.String recipientId) { + this.recipientId = recipientId; + } + public void setData(java.util.List data) { + this.data = data; + } + + + + + @Override + public boolean equals(java.lang.Object _uniffiOther) { + if (_uniffiOther instanceof WifiDirectMessage) { + WifiDirectMessage _uniffiThat = (WifiDirectMessage) _uniffiOther; + return ( + java.util.Objects.equals(recipientId, _uniffiThat.recipientId) && + + java.util.Objects.equals(data, _uniffiThat.data) + + ); + }; + return false; + } + @Override + public int hashCode() { + int _uniffiHash = 17; + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(recipientId); + _uniffiHash = 31 * _uniffiHash + java.util.Objects.hashCode(data); + return _uniffiHash; + } + + + + + +} + + diff --git a/bindings/java/src/main/java/com/offlineprotocol/sdk/WifiDirectTransportCallback.java b/bindings/java/src/main/java/com/offlineprotocol/sdk/WifiDirectTransportCallback.java new file mode 100644 index 00000000..e0a2e4da --- /dev/null +++ b/bindings/java/src/main/java/com/offlineprotocol/sdk/WifiDirectTransportCallback.java @@ -0,0 +1,6 @@ +package com.offlineprotocol.sdk; + +public interface WifiDirectTransportCallback { + public void onMessagesAvailable(); + +} diff --git a/bindings/java/src/test/java/com/offlineprotocol/sdk/ConsumerCheckTest.java b/bindings/java/src/test/java/com/offlineprotocol/sdk/ConsumerCheckTest.java new file mode 100644 index 00000000..704002d3 --- /dev/null +++ b/bindings/java/src/test/java/com/offlineprotocol/sdk/ConsumerCheckTest.java @@ -0,0 +1,141 @@ +package com.offlineprotocol.sdk; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +/** + * The Java program that proves the generated binding, the library and the + * interface definition agree: the counterpart of bindings/c/consumer-check/main.c. + * It loads the real library, whose FFI checksums the generated code verifies + * before the first call, so a binding generated from a different definition + * than the library fails every test here. + */ +class ConsumerCheckTest { + /** A configuration with the definition's defaults; the generated record has no defaults of its own. */ + static ProtocolConfig config() { + return new ProtocolConfig( + "com.example.java", "java-consumer", + false, false, true, false, false, false, // ble, wifi direct, internet, reticulum, nostr, prefer online + (byte) 8, true, true, true, true, // initial ttl, encryption, auto key exchange, store pending, require encryption + 64L, 4096L, 60_000L, OverflowPolicy.DROP_OLDEST, + false, 256, true, true, false, false, // edge-driven DM, group size, group relay x2, admin commits, transport identity + true, true, true, false, true, true, true, // binary wire, nostr x3, compact envelope, rich payload, recovery + null, null, // mesh relay, custody + true, true, true); // data, control freshness, encrypt service messages + } + + static final byte[] STORE_KEY = new byte[32]; + + static { + for (int i = 0; i < STORE_KEY.length; i++) { + STORE_KEY[i] = (byte) i; + } + } + + @Test + void anInstanceLessFunctionNeedsNoEngine() throws Exception { + List publicKey = new ArrayList<>(Collections.nCopies(32, (byte) 0)); + String address = OfflineProtocolLib.deriveAddress(publicKey); + assertTrue(address.startsWith("off1"), address); + } + + @Test + void anEngineAnswersAndEventsReachBothTheCallbackAndThePollQueue() throws Exception { + try (OfflineProtocol engine = new OfflineProtocol(config())) { + assertEquals(ProtocolState.STOPPED, engine.getState()); + + List heard = new CopyOnWriteArrayList<>(); + Thread[] on = new Thread[1]; + engine.setEventCallback(json -> { + on[0] = Thread.currentThread(); + heard.add(json); + }); + engine.emitTestEvent(); + assertEquals(1, heard.size()); + assertEquals(Thread.currentThread(), on[0], "the event runs on the calling thread"); + assertEquals(heard.get(0), engine.pollEvent()); + assertNull(engine.pollEvent()); + } + } + + @Test + void anEngineRefusalIsATypedException() throws Exception { + try (OfflineProtocol engine = new OfflineProtocol(config())) { + engine.start(); + // No storage yet, so there is no session to encrypt under. + assertThrows(ProtocolException.EncryptFailed.class, () -> engine.sendMessage( + "off1qyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyr4s29s", "hi", MessagePriority.MEDIUM, null)); + engine.stop(); + } + } + + @Test + void aJavaStorageProviderPassesTheConformanceSuite() { + String report = OfflineProtocolLib.runStorageConformance(new MemoryStorage().state); + assertTrue(report.contains("\"failures\":[]"), report); + } + + @Test + void twoJavaProvidersGiveTheEngineAnAddress() throws Exception { + MemoryStorage secure = new MemoryStorage(); + MemoryStorage state = new MemoryStorage(); + try (OfflineProtocol engine = new OfflineProtocol(config())) { + engine.initializeMls(secure.mls, state.state); + assertTrue(engine.localAddress().startsWith("off1")); + assertTrue(secure.size() > 0, "nothing reached the secure provider"); + engine.start(); + engine.stop(); + } + } + + @Test + void theBuiltInFileStoresNeedNoProvider(@TempDir Path dir) throws Exception { + Path mls = Files.createDirectory(dir.resolve("mls")); + Path state = Files.createDirectory(dir.resolve("state")); + try (OfflineProtocol engine = new OfflineProtocol(config())) { + engine.initializeMlsWithFileStores(mls.toString(), state.toString(), STORE_KEY); + assertTrue(engine.localAddress().startsWith("off1")); + engine.closeFileStores(); + } + } + + @Test + void aProviderThatThrowsIsReportedAsAStorageFailure() { + ProtocolStateStorageProvider failing = new ProtocolStateStorageProvider() { + @Override + public void store(String keyType, String keyId, byte[] data) throws MlsStorageException { + throw new MlsStorageException.StoreFailed("disk full"); + } + + @Override + public byte[] load(String keyType, String keyId) { + return null; + } + + @Override + public void delete(String keyType, String keyId) { + } + + @Override + public List listKeys(String keyType) { + return new ArrayList<>(); + } + }; + String report = OfflineProtocolLib.runStorageConformance(failing); + assertFalse(report.contains("\"failures\":[]"), "a provider that cannot store must not pass: " + report); + // The exception crossed back into the engine as its storage error, not as a crash. + assertTrue(report.contains("Failed to store protocol state"), report); + } +} diff --git a/bindings/java/src/test/java/com/offlineprotocol/sdk/MemoryStorage.java b/bindings/java/src/test/java/com/offlineprotocol/sdk/MemoryStorage.java new file mode 100644 index 00000000..71c3e9b0 --- /dev/null +++ b/bindings/java/src/test/java/com/offlineprotocol/sdk/MemoryStorage.java @@ -0,0 +1,94 @@ +package com.offlineprotocol.sdk; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * A thread-safe in-memory store, as a host writes one, behind both storage + * interfaces. They cannot be one class: the key material interface takes and + * returns {@code List} and the protocol-state one {@code byte[]}, and + * their {@code load} methods differ only in return type. + */ +final class MemoryStorage { + private final Map entries = new ConcurrentHashMap<>(); + + private static String key(String type, String id) { + return type + '\u0000' + id; + } + + private List keys(String keyType) { + List ids = new ArrayList<>(); + String prefix = keyType + '\u0000'; + for (String k : entries.keySet()) { + if (k.startsWith(prefix)) { + ids.add(k.substring(prefix.length())); + } + } + return ids; + } + + int size() { + return entries.size(); + } + + /** The protocol-state provider: bytes as {@code byte[]}. */ + final ProtocolStateStorageProvider state = new ProtocolStateStorageProvider() { + @Override + public void store(String keyType, String keyId, byte[] data) { + entries.put(key(keyType, keyId), data.clone()); + } + + @Override + public byte[] load(String keyType, String keyId) { + byte[] v = entries.get(key(keyType, keyId)); + return v == null ? null : v.clone(); + } + + @Override + public void delete(String keyType, String keyId) { + entries.remove(key(keyType, keyId)); + } + + @Override + public List listKeys(String keyType) { + return keys(keyType); + } + }; + + /** The key material provider: bytes as {@code List}. */ + final MlsStorageProvider mls = new MlsStorageProvider() { + @Override + public void store(String keyType, String keyId, List data) { + byte[] bytes = new byte[data.size()]; + for (int i = 0; i < bytes.length; i++) { + bytes[i] = data.get(i); + } + entries.put(key(keyType, keyId), bytes); + } + + @Override + public List load(String keyType, String keyId) { + byte[] v = entries.get(key(keyType, keyId)); + if (v == null) { + return null; + } + List out = new ArrayList<>(v.length); + for (byte b : v) { + out.add(b); + } + return out; + } + + @Override + public void delete(String keyType, String keyId) { + entries.remove(key(keyType, keyId)); + } + + @Override + public List listKeys(String keyType) { + return keys(keyType); + } + }; +} diff --git a/bindings/java/uniffi.toml b/bindings/java/uniffi.toml new file mode 100644 index 00000000..83b25fd8 --- /dev/null +++ b/bindings/java/uniffi.toml @@ -0,0 +1,5 @@ +# Configuration for uniffi-bindgen-java. scripts/generate-bindings.sh passes this +# file with --config; see docs/bridges/java.md. +[defaults.bindings.java] +package_name = "com.offlineprotocol.sdk" +cdylib_name = "offline_protocol_uniffi" diff --git a/bindings/python/README.md b/bindings/python/README.md index 7d836dba..944fd66f 100644 --- a/bindings/python/README.md +++ b/bindings/python/README.md @@ -116,11 +116,11 @@ pip install -e . ``` `build-desktop.sh` compiles the Rust core for your platform and generates the -FFI bindings. It regenerates Swift and Kotlin alongside Python by delegating to -the repo-root `scripts/generate-bindings.sh`: the three are one artifact set +FFI bindings. It regenerates Swift, Kotlin and Java alongside Python by delegating to +the repo-root `scripts/generate-bindings.sh`: the four are one artifact set off one UDL, so they are never refreshed apart. -**Prerequisites:** Rust toolchain, `uniffi-bindgen` (`cargo install uniffi --version 0.32.2 --features cli --locked`). +**Prerequisites:** Rust toolchain, `uniffi-bindgen` (`cargo install uniffi --version 0.32.2 --features cli --locked`) and `uniffi-bindgen-java` (`cargo install uniffi-bindgen-java --version 0.5.2 --locked`). ### A Linux wheel from a checkout, on another host diff --git a/bindings/python/scripts/build-desktop.sh b/bindings/python/scripts/build-desktop.sh index a5780b8a..018ed951 100755 --- a/bindings/python/scripts/build-desktop.sh +++ b/bindings/python/scripts/build-desktop.sh @@ -87,6 +87,13 @@ if ! command -v uniffi-bindgen &>/dev/null; then echo " cargo install uniffi --version 0.32.2 --features cli --locked" >&2 exit 1 fi +if ! command -v uniffi-bindgen-java &>/dev/null; then + echo "Error: uniffi-bindgen-java not found — the generator writes the Java" >&2 + echo "binding in the same run, and would fail after the library is built:" >&2 + echo "" >&2 + echo " cargo install uniffi-bindgen-java --version 0.5.2 --locked" >&2 + exit 1 +fi # Determine library filename by platform case "$TARGET" in @@ -171,7 +178,7 @@ case "$TARGET" in esac # Generate the bindings. This regenerates Swift and Kotlin alongside Python: -# the three are one artifact set off one UDL, and the whole point of the shared +# the four are one artifact set off one UDL, and the whole point of the shared # script is that no entry point can refresh a subset. See its header. echo "" bash "$PROJECT_ROOT/scripts/generate-bindings.sh" diff --git a/bindings/react-native/WIRING_GUIDE.md b/bindings/react-native/WIRING_GUIDE.md index 1363f6a0..97642e32 100644 --- a/bindings/react-native/WIRING_GUIDE.md +++ b/bindings/react-native/WIRING_GUIDE.md @@ -59,8 +59,8 @@ interface OfflineProtocol { ./scripts/generate-bindings.sh # or: npm run generate:bindings ``` -This regenerates Swift, Kotlin **and** Python in one pass — they are one -artifact set off one UDL, so they are never refreshed apart. Commit all three. +This regenerates Swift, Kotlin, Python **and** Java in one pass — they are one +artifact set off one UDL, so they are never refreshed apart. Commit all four. This auto-generates: - `ios/Generated/offline_protocol.swift` — Swift wrapper classes @@ -164,7 +164,7 @@ Use this checklist every time you add or modify a bridged method: ``` [ ] Rust implementation in uniffi crate (lib.rs) [ ] UDL declaration (offline_protocol.udl) -[ ] Regenerated bindings (./scripts/generate-bindings.sh) and committed all three +[ ] Regenerated bindings (./scripts/generate-bindings.sh) and committed all four [ ] iOS: @objc func in OfflineProtocolModule.swift [ ] iOS: RCT_EXTERN_METHOD in OfflineProtocolModule.m ← EASY TO FORGET [ ] iOS: Parameter types in .m match the Swift signature exactly diff --git a/bindings/react-native/scripts/build-uniffi-all.sh b/bindings/react-native/scripts/build-uniffi-all.sh index a90cd426..0901bd1b 100755 --- a/bindings/react-native/scripts/build-uniffi-all.sh +++ b/bindings/react-native/scripts/build-uniffi-all.sh @@ -27,6 +27,14 @@ if ! command -v uniffi-bindgen &> /dev/null; then echo "" >&2 exit 1 fi +if ! command -v uniffi-bindgen-java &> /dev/null; then + echo "❌ Error: uniffi-bindgen-java not found — the generator writes the Java" >&2 + echo " binding in the same run as Swift, Kotlin and Python." >&2 + echo "" >&2 + echo " cargo install uniffi-bindgen-java --version 0.5.2 --locked" >&2 + echo "" >&2 + exit 1 +fi # Build iOS echo "📱 Building iOS + generating bindings..." @@ -52,17 +60,18 @@ echo "" # Unconditional: the bindgen check at the top exits rather than continuing, and # both platform scripts fail if generation does not happen, so reaching here -# means all three were written. The iOS and Android scripts each delegate to the +# means all four were written. The iOS and Android scripts each delegate to the # shared generator, so the full set is written twice — deliberate, since both # are also run on their own and idempotent regeneration is cheaper than letting # either emit only its own language. -echo "Generated bindings (all three — one artifact set off one UDL):" +echo "Generated bindings (all four — one artifact set off one UDL):" echo " Swift: bindings/react-native/ios/Generated/" echo " Kotlin: bindings/react-native/android/src/main/java/uniffi/" echo " Python: bindings/python/offline_protocol_sdk/" +echo " Java: bindings/java/src/main/java/" echo "" echo "Next steps:" -echo " 1. Commit all three together — a partial commit is drift" +echo " 1. Commit all four together — a partial commit is drift" echo " 2. Test on iOS and Android" echo " 3. Run 'npm publish' to distribute the package" diff --git a/crates/offline-protocol-uniffi/README.md b/crates/offline-protocol-uniffi/README.md index f43e90fb..c2ac6f8c 100644 --- a/crates/offline-protocol-uniffi/README.md +++ b/crates/offline-protocol-uniffi/README.md @@ -1,6 +1,6 @@ # offline-protocol-uniffi -[UniFFI](https://mozilla.github.io/uniffi-rs/) bindings crate for the [Offline Protocol SDK](https://github.com/Offline-Protocol/offline-protocol-sdk). Builds the `cdylib`/`staticlib` and FFI scaffolding from which the SDK's Swift, Kotlin, and Python bindings are generated. +[UniFFI](https://mozilla.github.io/uniffi-rs/) bindings crate for the [Offline Protocol SDK](https://github.com/Offline-Protocol/offline-protocol-sdk). Builds the `cdylib`/`staticlib` and FFI scaffolding from which the SDK's Swift, Kotlin, Python, and Java bindings are generated. This crate is not meant to be consumed directly: @@ -8,7 +8,7 @@ This crate is not meant to be consumed directly: - **React Native** (iOS/Android) apps want [`@offline-protocol/mesh-sdk`](https://www.npmjs.com/package/@offline-protocol/mesh-sdk) - **Python** (macOS/Linux/Windows) apps want the [Python binding](https://github.com/Offline-Protocol/offline-protocol-sdk/blob/main/bindings/python/README.md) -The generated bindings carry FFI checksums of the exact library they were generated against, so the library and all three language bindings are regenerated together from one script — see [the repository](https://github.com/Offline-Protocol/offline-protocol-sdk#regenerate-bindings-after-a-udl-change) for the build workflow. +The generated bindings carry FFI checksums of the exact library they were generated against, so the library and all four language bindings are regenerated together from one script — see [the repository](https://github.com/Offline-Protocol/offline-protocol-sdk#regenerate-bindings-after-a-udl-change) for the build workflow. ## License diff --git a/docs/README.md b/docs/README.md index a8f02fab..ef32f19f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -112,6 +112,7 @@ in here fails **silently** when violated. | [TypeScript](bridges/typescript.md) | The React Native JavaScript surface | | [Local API](bridges/local-api.md) | A server fronting one engine for several local clients over a socket | | [C](bridges/c.md) | The C API: the local API called in process, for C and every language that calls C | +| [Java](bridges/java.md) | The generated Java binding for the JVM, over the foreign function API | ## Release history diff --git a/docs/bridges/README.md b/docs/bridges/README.md index 51981c4d..7463e617 100644 --- a/docs/bridges/README.md +++ b/docs/bridges/README.md @@ -1,6 +1,6 @@ # Bridge contracts -The Rust core is exposed to Swift, Kotlin, Python, TypeScript and C. This +The Rust core is exposed to Swift, Kotlin, Python, TypeScript, C and Java. This directory states what each binding owes the core and what the core owes each binding. @@ -13,6 +13,7 @@ binding. | [TypeScript](typescript.md) | The React Native JavaScript surface | | [Local API](local-api.md) | A server fronting one engine for several local clients over a socket, and the reference server | | [C](c.md) | The C API in `bindings/c`: the local API called in process | +| [Java](java.md) | The generated Java binding in `bindings/java` | Integration **guides** live elsewhere: [iOS](../ios-integration.md), [Android](../android-integration.md), @@ -31,9 +32,10 @@ green `tsc` say nothing about any of them. ## C1. Regenerate every binding together -The Swift, Kotlin, and Python bindings are **one artifact set**, not three -independent ones. They come from one bindgen run over one interface definition -and carry the FFI checksums of the library they were generated against. +The Swift, Kotlin, Python and Java bindings are **one artifact set**, not four +independent ones. They come from one interface definition, through +`uniffi-bindgen` for the first three and `uniffi-bindgen-java` for the last, and +carry the FFI checksums of the library they were generated against. ```bash ./scripts/generate-bindings.sh diff --git a/docs/bridges/java.md b/docs/bridges/java.md new file mode 100644 index 00000000..e9483432 --- /dev/null +++ b/docs/bridges/java.md @@ -0,0 +1,139 @@ +# Java binding contract + +Covers `bindings/java`: the typed Java API generated from the interface +definition, for the JVM on desktop and server. + +Read [the shared contract](README.md) first. This document covers what is +specific to Java. + +## What it is + +The Java binding is generated by `uniffi-bindgen-java` from the same UDL as +Swift, Kotlin and Python, and committed under `bindings/java/src/main/java`. +It is the fourth member of the artifact set in +[C1](README.md#c1-regenerate-every-binding-together). It talks to the native +library through the Java foreign function API, not through JNA and not through +[the C API](c.md): there is no hand-written code in it at all, which is why most +of the rules below are about what the host owes. + +It is not the Kotlin binding. That one is the Android library and the React +Native Android bridge, built on JNA and shipped as an AAR. A JVM application +that is not on Android uses this one. + +## Which shared rules apply + +| Rule | How it reaches the Java binding | +|---|---| +| [C1](README.md#c1-regenerate-every-binding-together) | Applies in full. `scripts/generate-bindings.sh` runs the Java generator with the other three, CI deletes and diffs `bindings/java/src/main/java/com/offlineprotocol/sdk` with them, and `scripts/tests/test-generate-bindings.sh` pins the output path, the call and the generator series | +| [C2](README.md#c2-the-error-enum-is-append-only) | The generated `ProtocolException` and `MlsStorageException` decode by positional discriminant, like every other binding. Append-only keeps them correct | +| [C3](README.md#c3-events-cross-as-opaque-json) | `EventCallback` and `pollEvent` deliver the engine's JSON. An event's fields appear in no Java type, and a field added to an event is invisible here until the host reads it | +| [C6](README.md#c6-config-parsers-must-not-default-to-literals) | Does not apply as a parser rule: there is none. See J2 for what it costs | +| [C9](README.md#c9-bridge-behaviour-is-not-covered-by-the-rust-test-suite) | `cargo test` proves nothing about this binding. `gradle build` in `bindings/java` runs `ConsumerCheckTest` against the real library, and CI runs it on Linux, macOS and Windows | +| [C11](README.md#c11-a-storage-adapter-is-a-supported-extension-point-and-is-verified) | A `ProtocolStateStorageProvider` is an adapter like any other: `OfflineProtocolLib.runStorageConformance` is the bar | +| [C12](README.md#c12-telemetry-is-callback-free-and-the-binding-fills-the-platform) | The exception. See J3 | + +## J1. The generator is versioned apart from uniffi, and tracks it by minor + +`uniffi-bindgen-java` is a community generator, not part of `uniffi-rs`. Its +0.5 series generates for UniFFI 0.32, 0.3 for 0.31, and 0.2 for 0.29; no +release matches an arbitrary UniFFI version, which is why the workspace pins a +`uniffi` the generator has a series for. The generated Java checks the library's +FFI contract version and every function's checksum when it loads, so a Java +generated against another UniFFI fails at the first call, not at build time. + +`scripts/generate-bindings.sh` therefore refuses any series but the one in +`JAVA_BINDGEN_SERIES`, before it writes anything, as it refuses a +`uniffi-bindgen` whose minor disagrees with the pin. A UniFFI bump moves the +`uniffi` pin, `JAVA_BINDGEN_SERIES`, and the installs in CI and the release +workflow together, and needs a generator release for the new minor. + +## J2. The generated records have no defaults + +A dictionary field with a default in the UDL (`require_encryption = true`) has +that default in the Rust, the Swift initializer, the Kotlin parameter default +and the Python keyword default. Java has no default arguments, and the +generator does not emit overloads, so `new ProtocolConfig(...)` takes all 35 +fields positionally and a caller spells the definition's defaults out. Optional +fields (`T?`) take `null`. + +This is the one place a Java caller can disagree with the other bindings about +a default and nothing catches it. When the definition's default for a field +changes, the Java caller keeps passing the old one. `ConsumerCheckTest.config()` +is the reference: it carries the definition's defaults, field for field, and is +the first place to update. + +## J3. The host fills the telemetry platform + +Rule C12 says a binding fills `TelemetryConfig.os` and `os_major`, never the +app. There is no hand-written layer in the Java binding to do it, so the host +passes them, as the C binding's host passes `os_major` +([c.md K3](c.md#k3-the-binding-fills-the-telemetry-platform)). They must be the +platform the process actually runs on (`TelemetryOs.LINUX`, `MACOS`, `WINDOWS`) +and its major version, read from the JVM's `os.name` and `os.version`, and not +a value forwarded from configuration: the ingest keys its per-platform +aggregates on them. + +`every_bridge_reads_the_telemetry_config_section` has nothing to read for Java, +so nothing enforces this. A wrapper that adds a lifecycle should report +`notifyAppState` on backgrounding, and no call to `disableTelemetry`, +`endTelemetrySession` or `flushTelemetryBlocking` belongs on a UI thread. + +## J4. Callbacks run on the engine's thread and must not call back in + +An `EventCallback` or transport callback runs synchronously, on the thread +inside the engine, before the engine call that produced it returns: the host's +own thread for an event `sendMessage` emitted, or one of the engine's. The +rules are [the C binding's K2](c.md#k2-callbacks-run-on-the-engines-thread-inside-the-engine): +a callback must be safe from any thread, must not call back into the engine, +and must not throw. Copy the event, queue it, return. The supported +alternative is `pollEvent`. Storage providers are called from any thread, +concurrently, so they must be thread-safe. + +Closing the engine from a callback is such a call. `close()` frees the engine, +and the engine is mid-call. + +## J5. Requirements the JVM imposes + +The foreign function API is final in Java 22, and the generated code needs it, +so the minimum is **JDK 22**. The code is compiled with `--release 22`; a host +on an older JVM cannot load it. The JVM must be allowed to call native code: +`--enable-native-access=ALL-UNNAMED` on the class path, or the module's name. +Without it the first call warns, and a future JDK will refuse. + +The native library is found through `java.library.path`, or by an absolute +path in `-Duniffi.component.offline_protocol.libraryOverride`. It is not +bundled in the jar. + +## J6. The jar is published to Maven Central, and does not carry the library + +`com.offlineprotocol:offline-protocol-java` is the Java binding, published at +the release's version beside the Android library (`offline-protocol-sdk`), by +the same switch and the same signing, and as its own deployment. The two are +different artifacts for different runtimes and never share a coordinate; an +application on Android uses the AAR, and any other JVM uses this jar. + +The jar contains the generated Java and the license notices under `META-INF`. +It contains no native code. The host supplies the native library for its +platform, from the release's assets, and points the JVM at it (J5). Publishing +a jar that appeared to work and failed at the first call on a platform it did +not carry would be worse than a jar that says what it needs, so the POM +description says so. + +The release does three things before anything is uploaded: it builds and tests +the committed sources against the release profile's library, writes the Maven +repository, and checks that the five files Central requires are all there. The +signing key reaches only `scripts/maven-central-bundle.sh`, never a Gradle +build. A version on Maven Central is permanent, so a dry run of the release +rehearses the upload against the real Portal and drops it. + +`gradle publishAllPublicationsToStagingRepository` writes the same repository +under `bindings/java/build/maven`, and the Java Binding job in CI runs it on +every pull request, so a POM or publication error shows there and not on a tag. + +## What the host owes + +The same things every binding owes, with nothing provided: the transports, two +storage providers or the built-in file stores, the lifecycle (`start`, `stop`, +`process` on a timer), and one engine freed once with no call in flight when it +is. Java's `try-with-resources` frees it once; it does not wait for calls in +flight on other threads. diff --git a/scripts/generate-bindings.sh b/scripts/generate-bindings.sh index 4ac047af..0c3b14a2 100755 --- a/scripts/generate-bindings.sh +++ b/scripts/generate-bindings.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# Generate every UniFFI binding from the one UDL: Swift, Kotlin and Python. +# Generate every UniFFI binding from the one UDL: Swift, Kotlin, Python and Java. # -# This is the single entry point, and the reason it exists is that the three -# generated files are one artifact set, not three independent ones: they are -# produced by one bindgen from one UDL and carry the FFI checksums of the +# This is the single entry point, and the reason it exists is that the four +# generated sets are one artifact set, not four independent ones: they are +# produced from one UDL and carry the FFI checksums of the # cdylib they were generated against. Regenerating a subset leaves the others # describing a different ABI — which does not fail any build, only the app at # the first call. Every caller that used to run `uniffi-bindgen` itself now @@ -27,7 +27,9 @@ # ./scripts/generate-bindings.sh # # Requires uniffi-bindgen matching the crate's `uniffi` pin; the check below -# reads that pin rather than repeating it. +# reads that pin rather than repeating it. Java is generated by the community +# uniffi-bindgen-java, which is versioned apart from uniffi and so pins its own +# minor below (JAVA_BINDGEN_SERIES). set -euo pipefail @@ -41,7 +43,7 @@ if [[ $# -gt 0 ]]; then # generate-bindings.sh, and the RN one execs this, so a basename cannot say # which of them rejected the flag. echo "Error: scripts/generate-bindings.sh takes no arguments (got: $*)." >&2 - echo "It generates Swift, Kotlin and Python together on purpose — they are one" >&2 + echo "It generates Swift, Kotlin, Python and Java together on purpose — they are one" >&2 echo "artifact set off one UDL, and a partial set fails at runtime, not build time." >&2 exit 2 fi @@ -54,6 +56,17 @@ UDL="src/offline_protocol.udl" SWIFT_OUT="$PROJECT_ROOT/bindings/react-native/ios/Generated" KOTLIN_OUT="$PROJECT_ROOT/bindings/react-native/android/src/main/java" PYTHON_OUT="$PROJECT_ROOT/bindings/python/offline_protocol_sdk" +JAVA_OUT="$PROJECT_ROOT/bindings/java/src/main/java" +JAVA_CONFIG="$PROJECT_ROOT/bindings/java/uniffi.toml" + +# uniffi-bindgen-java is versioned apart from uniffi-rs and tracks it by minor: +# 0.5.x generates for UniFFI 0.32, and the FFI checks it emits would fail at the +# first call against any other. A new series means a uniffi bump, so this moves +# in the same change as the pin in crates/offline-protocol-uniffi/Cargo.toml. +# JAVA_BINDGEN_VERSION is the exact release every install names (CI, the +# release workflow, the docs); test-generate-bindings.sh holds them to it. +JAVA_BINDGEN_VERSION="0.5.2" +JAVA_BINDGEN_SERIES="${JAVA_BINDGEN_VERSION%.*}" # The bindgen version is baked into the generated code as FFI checksums, so # generating with a bindgen that disagrees with the crate's `uniffi` compiles @@ -91,6 +104,24 @@ if [[ "$INSTALLED_MAJOR_MINOR" != "$REQUIRED_MAJOR_MINOR" ]]; then exit 1 fi +if ! command -v uniffi-bindgen-java &>/dev/null; then + echo "Error: uniffi-bindgen-java not found." >&2 + echo "" >&2 + echo " cargo install uniffi-bindgen-java --version ${JAVA_BINDGEN_VERSION} --locked" >&2 + echo "" >&2 + exit 1 +fi + +INSTALLED_JAVA_VERSION="$(uniffi-bindgen-java --version | awk '{print $NF}')" +if [[ "$(printf '%s' "$INSTALLED_JAVA_VERSION" | cut -d. -f1,2)" != "$JAVA_BINDGEN_SERIES" ]]; then + echo "Error: uniffi-bindgen-java $INSTALLED_JAVA_VERSION is not in the ${JAVA_BINDGEN_SERIES}.x series that matches uniffi $REQUIRED_VERSION." >&2 + echo "Its generated Java checks the library's FFI contract and fails at the first call, not at build time." >&2 + echo "" >&2 + echo " cargo install uniffi-bindgen-java --version ${JAVA_BINDGEN_VERSION} --locked --force" >&2 + echo "" >&2 + exit 1 +fi + # --no-format is load-bearing, not tidiness: uniffi-bindgen shells out to # ktlint for Kotlin and swiftformat for Swift *when they happen to be on PATH*, # so without it the bytes written depend on what the developer has installed. @@ -105,11 +136,21 @@ generate() { printf ' %-7s -> %s\n' "$language" "${out_dir#"$PROJECT_ROOT"/}" } +# The Java generator takes no --language and reads its settings (package and +# library name) from a global config file, but is otherwise driven the same +# way, and --no-format pins its output for the reason above. +generate_java() { + mkdir -p "$JAVA_OUT" + uniffi-bindgen-java generate --no-format "$UDL" --out-dir "$JAVA_OUT" --config "$JAVA_CONFIG" + printf ' %-7s -> %s\n' java "${JAVA_OUT#"$PROJECT_ROOT"/}" +} + cd "$UNIFFI_DIR" echo "Generating UniFFI bindings from $UDL (uniffi-bindgen $INSTALLED_VERSION)" generate swift "$SWIFT_OUT" generate kotlin "$KOTLIN_OUT" generate python "$PYTHON_OUT" +generate_java -echo "All bindings generated. Commit all three together — a partial commit is drift." +echo "All bindings generated. Commit all four together — a partial commit is drift." diff --git a/scripts/maven-central-bundle.sh b/scripts/maven-central-bundle.sh index ae9f5786..baab6cde 100755 --- a/scripts/maven-central-bundle.sh +++ b/scripts/maven-central-bundle.sh @@ -18,6 +18,12 @@ # bash scripts/maven-central-bundle.sh # # Prints the signing key's fingerprint, so the log says which key signed. +# +# Two libraries are published this way: the Android library (the default, +# offline-protocol-sdk as an aar) and the Java binding +# (MAVEN_ARTIFACT_ID=offline-protocol-java MAVEN_PACKAGING=jar). They are +# separate bundles and separate deployments, so one failing cannot hold the +# other back. set -euo pipefail @@ -32,17 +38,19 @@ BUNDLE="$2" VERSION="$3" : "${SIGNING_KEY:?SIGNING_KEY must hold the armored private signing key}" -COORDINATE="com/offlineprotocol/offline-protocol-sdk" -ARTIFACT="offline-protocol-sdk-$VERSION" +ARTIFACT_ID="${MAVEN_ARTIFACT_ID:-offline-protocol-sdk}" +PACKAGING="${MAVEN_PACKAGING:-aar}" +COORDINATE="com/offlineprotocol/$ARTIFACT_ID" +ARTIFACT="$ARTIFACT_ID-$VERSION" SOURCE="$REPOSITORY/$COORDINATE/$VERSION" [ -d "$SOURCE" ] || die "no $VERSION in the repository: $SOURCE" VERSIONS="$(find "$REPOSITORY/$COORDINATE" -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')" [ "$VERSIONS" = 1 ] || die "the repository holds $VERSIONS versions; a bundle is one release" -# What Central requires of an Android library: the artifact, its POM, sources +# What Central requires of a library: the artifact, its POM, sources # and javadoc. The Gradle module file goes too, for Gradle consumers. -FILES=("$ARTIFACT.aar" "$ARTIFACT.pom" "$ARTIFACT.module" "$ARTIFACT-sources.jar" "$ARTIFACT-javadoc.jar") +FILES=("$ARTIFACT.$PACKAGING" "$ARTIFACT.pom" "$ARTIFACT.module" "$ARTIFACT-sources.jar" "$ARTIFACT-javadoc.jar") for file in "${FILES[@]}"; do [ -s "$SOURCE/$file" ] || die "missing or empty: $file" done diff --git a/scripts/maven-central-upload.sh b/scripts/maven-central-upload.sh index 228e5523..1621d0db 100755 --- a/scripts/maven-central-upload.sh +++ b/scripts/maven-central-upload.sh @@ -26,6 +26,8 @@ # CENTRAL_REPOSITORY defaults to https://repo1.maven.org/maven2 # POLL_SECONDS defaults to 15 # POLLS defaults to 120 (thirty minutes) +# MAVEN_ARTIFACT_ID defaults to offline-protocol-sdk (the Android library); +# offline-protocol-java for the Java binding set -euo pipefail @@ -46,7 +48,8 @@ API="${CENTRAL_API:-https://central.sonatype.com/api/v1/publisher}" REPOSITORY="${CENTRAL_REPOSITORY:-https://repo1.maven.org/maven2}" POLL_SECONDS="${POLL_SECONDS:-15}" POLLS="${POLLS:-120}" -POM="$REPOSITORY/com/offlineprotocol/offline-protocol-sdk/$VERSION/offline-protocol-sdk-$VERSION.pom" +ARTIFACT_ID="${MAVEN_ARTIFACT_ID:-offline-protocol-sdk}" +POM="$REPOSITORY/com/offlineprotocol/$ARTIFACT_ID/$VERSION/$ARTIFACT_ID-$VERSION.pom" case "$MODE" in publish) PUBLISHING_TYPE=AUTOMATIC ;; @@ -55,7 +58,7 @@ case "$MODE" in esac if [ "$MODE" = publish ] && curl -sSfI "$POM" >/dev/null 2>&1; then - echo "::notice title=Already on Maven Central::offline-protocol-sdk $VERSION is already on Maven Central, and a version there is permanent. Nothing uploaded." + echo "::notice title=Already on Maven Central::$ARTIFACT_ID $VERSION is already on Maven Central, and a version there is permanent. Nothing uploaded." exit 0 fi @@ -70,7 +73,7 @@ trap 'rm -f "$RESPONSE"' EXIT # --fail-with-body keeps the Portal's explanation on a refusal. if ! curl -sS --fail-with-body -X POST -H "$AUTH" \ -F "bundle=@$BUNDLE;type=application/octet-stream" \ - "$API/upload?publishingType=$PUBLISHING_TYPE&name=offline-protocol-sdk-$VERSION" >"$RESPONSE"; then + "$API/upload?publishingType=$PUBLISHING_TYPE&name=$ARTIFACT_ID-$VERSION" >"$RESPONSE"; then echo "The Portal refused the upload:" >&2 cat "$RESPONSE" >&2 echo >&2 @@ -101,7 +104,7 @@ for poll in $(seq 1 "$POLLS"); do VALIDATED) if [ "$MODE" = rehearse ]; then drop - echo "Rehearsed: Maven Central validated offline-protocol-sdk $VERSION, and the deployment was dropped." + echo "Rehearsed: Maven Central validated $ARTIFACT_ID $VERSION, and the deployment was dropped." exit 0 fi ;; @@ -109,7 +112,7 @@ for poll in $(seq 1 "$POLLS"); do [ "$MODE" = publish ] || die "a rehearsal deployment is $STATE: it was uploaded as $PUBLISHING_TYPE and should not publish" # Validated and released. Central takes a while longer to make it # readable; nothing after this point can stop it. - echo "offline-protocol-sdk $VERSION is $STATE on Maven Central." + echo "$ARTIFACT_ID $VERSION is $STATE on Maven Central." exit 0 ;; PENDING | VALIDATING) ;; diff --git a/scripts/tests/test-generate-bindings.sh b/scripts/tests/test-generate-bindings.sh index d5cba371..fe16462e 100755 --- a/scripts/tests/test-generate-bindings.sh +++ b/scripts/tests/test-generate-bindings.sh @@ -6,7 +6,7 @@ # always regenerated together — they are one artifact set off one UDL, and a # partial set does not fail any build, only the app at its first FFI call. That # property is only as good as two things nothing else checks: that the -# generator still writes all three languages to the three committed paths, and +# generator still writes all four languages to the four committed paths, and # that nothing else in the repo shells out to uniffi-bindgen behind its back. # # Both are asserted here, and deliberately by *behavior* rather than by @@ -55,10 +55,10 @@ cd "$REPO_ROOT" # uniffi-bindgen to generate the bindings" from matching while every command # form does. SQ=\' -INVOCATION='(^|[^[:alnum:]_-])uniffi-bindgen([[:space:]]+-{1,2}[^[:space:]]+([[:space:]]+[^-[:space:]][^[:space:]]*)?)*[[:space:]]+generate' -INVOCATION="$INVOCATION"'|(^|[^[:alnum:]_-])uniffi-bindgen[[:space:]]*\\[[:space:]]*$' +INVOCATION='(^|[^[:alnum:]_-])uniffi-bindgen(-java)?([[:space:]]+-{1,2}[^[:space:]]+([[:space:]]+[^-[:space:]][^[:space:]]*)?)*[[:space:]]+generate' +INVOCATION="$INVOCATION"'|(^|[^[:alnum:]_-])uniffi-bindgen(-java)?[[:space:]]*\\[[:space:]]*$' INVOCATION="$INVOCATION"'|--bin[[:space:]]+uniffi-bindgen' -INVOCATION="$INVOCATION|uniffi-bindgen[\"${SQ}]?[],[:space:]\"${SQ}[]*generate" +INVOCATION="$INVOCATION|uniffi-bindgen(-java)?[\"${SQ}]?[],[:space:]\"${SQ}[]*generate" # A line that actually *runs* the generator, as opposed to merely naming it. # The interpreter is optional because the script is executable and this PR's @@ -119,6 +119,7 @@ bindings/react-native/scripts/build-all.sh:build-uniffi-all.sh # lists so they are size-pinned too: they are what proves the scan can fire. HIT_FIXTURES=" inline +java continued global-option cargo-run @@ -134,15 +135,16 @@ prose prose-adjacent " -# The three committed paths, repo-relative. CI deletes exactly these before +# The four committed paths, repo-relative. CI deletes exactly these before # regenerating and diffs exactly these afterwards; if the generator ever writes # somewhere else, `git diff` on a path nothing wrote to reports no diff and the # gate goes green on stale bindings. This list is the single record of what -# those three places must agree on, and it is checked against both. +# those four places must agree on, and it is checked against both. EXPECTED_OUTPUTS=" swift:bindings/react-native/ios/Generated kotlin:bindings/react-native/android/src/main/java python:bindings/python/offline_protocol_sdk +java:bindings/java/src/main/java " # Total number of assertions a healthy run makes. This is the backstop for the @@ -157,7 +159,7 @@ python:bindings/python/offline_protocol_sdk # purpose. That is the intended cost: the failure is loud, names the expected # and actual counts, and updating it is a deliberate one-line acknowledgement # that the guard's coverage changed. -EXPECTED_ASSERTIONS=54 +EXPECTED_ASSERTIONS=63 FAILURES=0 ASSERTIONS=0 @@ -249,7 +251,7 @@ ci_step_body() { echo "Guarding the shared binding generator..." -assert_list_size EXPECTED_OUTPUTS 3 "$EXPECTED_OUTPUTS" +assert_list_size EXPECTED_OUTPUTS 4 "$EXPECTED_OUTPUTS" assert_list_size DELEGATING_CALLERS 6 "$DELEGATING_CALLERS" assert_list_size NATIVE_BUILD_ALIASES 3 "$NATIVE_BUILD_ALIASES" # EXPECTED_OUTPUTS is covered by assert_set_equals against a hardcoded literal; @@ -281,7 +283,7 @@ trap 'rm -rf "$STUB_ROOT"' EXIT # a temp dir and moving) report "never generated " — a false failure # whose message points at the wrong thing entirely. make_stub() { - local bin_dir="$1" reported="$2" + local bin_dir="$1" reported="$2" java_reported="${3:-0.5.2}" mkdir -p "$bin_dir" cat >"$bin_dir/uniffi-bindgen" <"\$(mktemp "\$STUB_LOG_DIR/call-XXXXXX")" exit 0 STUB chmod +x "$bin_dir/uniffi-bindgen" + + # The Java generator has no --language, so the stub logs one for it: the + # per-language checks below then read all four calls the same way. + cat >"$bin_dir/uniffi-bindgen-java" <"\$(mktemp "\$STUB_LOG_DIR/call-XXXXXX")" +exit 0 +STUB + chmod +x "$bin_dir/uniffi-bindgen-java" } # Value of `--flag value` or `--flag=value`, from a NUL-separated argv file. @@ -374,10 +390,10 @@ else fi call_count="$(find "$call_dir" -type f | wc -l | tr -d ' ')" -if [[ "$call_count" -eq 3 ]]; then - pass "it invoked bindgen exactly 3 times — one per language" +if [[ "$call_count" -eq 4 ]]; then + pass "it invoked bindgen exactly 4 times — one per language" else - fail "it invoked bindgen $call_count time(s), expected 3 (Swift, Kotlin, Python)" + fail "it invoked bindgen $call_count time(s), expected 4 (Swift, Kotlin, Python, Java)" fi languages_seen="" @@ -445,7 +461,7 @@ done </dev/null 2>&1; then + fail "$GENERATOR generated with a uniffi-bindgen-java outside the series that matches the crate pin" +else + bad_java_calls="$(find "$STUB_ROOT/bad-java-calls" -type f | wc -l | tr -d ' ')" + if [[ "$bad_java_calls" -eq 0 ]]; then + pass "a uniffi-bindgen-java outside its series is rejected before anything is written" + else + fail "$GENERATOR refused the mismatched Java bindgen only after $bad_java_calls call(s) — Swift, Kotlin or Python was already written" + fi +fi + +# The exact Java generator release is written down wherever someone is told to +# install it, and only the series is checked at run time. A moved pin that misses +# one place leaves an install that still passes the series gate but is not what +# CI verified, so every literal is held to the script's JAVA_BINDGEN_VERSION. +JAVA_VERSION="$(sed -n 's/^JAVA_BINDGEN_VERSION="\([0-9.]*\)"$/\1/p' "$GENERATOR" | head -1)" +if [[ ! "$JAVA_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + fail "could not read JAVA_BINDGEN_VERSION from $GENERATOR — the pin-agreement checks would pass vacuously" +else + java_pins="$(git grep -hoE 'uniffi-bindgen-java --version [0-9]+\.[0-9]+\.[0-9]+' -- . ':!scripts/tests' | awk '{print $3}' | sort -u)" + if [[ -z "$java_pins" ]]; then + fail "no document or workflow names a uniffi-bindgen-java version — the scan found nothing to compare" + else + assert_set_equals "every written uniffi-bindgen-java install" "$JAVA_VERSION" "$(printf '%s' "$java_pins" | tr '\n' ' ' | sed 's/ $//')" + fi + release_pin="$(sed -n 's/^ UNIFFI_BINDGEN_JAVA_VERSION: "\([0-9.]*\)"$/\1/p' .github/workflows/release.yml | head -1)" + assert_set_equals "the release workflow's Java generator version" "$JAVA_VERSION" "$release_pin" +fi + # --------------------------------------------------------------------------- # 4. Nothing else invokes uniffi-bindgen — any tracked file, matched by # content. Excluded by pathspec rather than by comparing "$0" against the @@ -557,6 +612,7 @@ fixtures="$STUB_ROOT/fixtures" mkdir -p "$fixtures" printf 'uniffi-bindgen generate x.udl --language swift\n' >"$fixtures/hit-inline" +printf 'uniffi-bindgen-java generate x.udl --out-dir out\n' >"$fixtures/hit-java" printf 'uniffi-bindgen \\\n generate x.udl --language kotlin\n' >"$fixtures/hit-continued" printf 'uniffi-bindgen --config u.toml generate x.udl\n' >"$fixtures/hit-global-option" printf 'cargo run --bin uniffi-bindgen -- generate x.udl\n' >"$fixtures/hit-cargo-run" @@ -574,7 +630,7 @@ printf 'the uniffi-bindgen generator produces code\n' >"$fixtures # the `-f` guard only fires when *nothing* matches. These negative controls are # the only evidence INVOCATION can fire at all, so quietly shrinking them is # the purest form of the vacuous pass. -assert_list_size HIT_FIXTURES 8 "$HIT_FIXTURES" +assert_list_size HIT_FIXTURES 9 "$HIT_FIXTURES" assert_list_size MISS_FIXTURES 3 "$MISS_FIXTURES" assert_no_duplicates HIT_FIXTURES "$HIT_FIXTURES" assert_no_duplicates MISS_FIXTURES "$MISS_FIXTURES" diff --git a/scripts/tests/test-maven-central.sh b/scripts/tests/test-maven-central.sh index ed3210ae..aa87de73 100755 --- a/scripts/tests/test-maven-central.sh +++ b/scripts/tests/test-maven-central.sh @@ -113,6 +113,40 @@ expect_bundle_failure "unexpected-file" extra_file expect_bundle_failure "two-versions" second_version expect_bundle_failure "wrong-passphrase" no_change wrong-passphrase +echo "== the Java binding's bundle ==" +# The same scripts publish com.offlineprotocol:offline-protocol-java, a jar +# where the Android library is an aar. The artifact id and the packaging are +# the only things that differ, and a repository holding the wrong one must be +# refused, not bundled under another library's name. +JAVA_COORDINATE="com/offlineprotocol/offline-protocol-java" +JAVA_ARTIFACT="offline-protocol-java-$VERSION" +JAVA_REPO="$WORK/java-repo" +mkdir -p "$JAVA_REPO/$JAVA_COORDINATE/$VERSION" +for file in "$JAVA_ARTIFACT.jar" "$JAVA_ARTIFACT.pom" "$JAVA_ARTIFACT.module" "$JAVA_ARTIFACT-sources.jar" "$JAVA_ARTIFACT-javadoc.jar"; do + echo "fixture $file" >"$JAVA_REPO/$JAVA_COORDINATE/$VERSION/$file" +done +java_bundle() { + MAVEN_ARTIFACT_ID=offline-protocol-java MAVEN_PACKAGING=jar \ + SIGNING_KEY="$SIGNING_KEY" SIGNING_KEY_PASSWORD=fixture-passphrase \ + bash "$BUNDLER" "$1" "$WORK/java-bundle.zip" "$VERSION" +} +if java_bundle "$JAVA_REPO" >"$WORK/java-bundle.log" 2>&1; then + pass "the Java binding's repository bundles" +else + fail "the Java binding's repository did not bundle" + cat "$WORK/java-bundle.log" >&2 +fi +if unzip -Z1 "$WORK/java-bundle.zip" | grep -qx "$JAVA_COORDINATE/$VERSION/$JAVA_ARTIFACT.jar.asc"; then + pass "its jar is signed, under its own coordinate" +else + fail "the Java bundle does not hold a signed jar under $JAVA_COORDINATE" +fi +if java_bundle "$WORK/repo" >"$WORK/java-wrong.log" 2>&1; then + fail "the Android library's repository was bundled as the Java binding" +else + pass "the Android library's repository is refused as the Java binding" +fi + # --------------------------------------------------------------------------- # A stand-in curl that plays the Portal. It answers the published-POM probe # from FAKE_ON_CENTRAL, the upload with a deployment id, each status request @@ -228,6 +262,21 @@ else fail "a rehearsal skipped its upload" fi +# The re-run probe must ask about the Java binding's own POM, or a release of the +# Android library would make the Java binding look already published. +: >"$WORK/curl.log" +if PATH="$FAKE_BIN:$PATH" FAKE_LOG="$WORK/curl.log" FAKE_STATES=PUBLISHED FAKE_ON_CENTRAL=1 \ + MAVEN_CENTRAL_USERNAME=user MAVEN_CENTRAL_PASSWORD=secret POLL_SECONDS=0 POLLS=5 \ + CENTRAL_API=https://portal.example/api CENTRAL_REPOSITORY=https://repo.example \ + MAVEN_ARTIFACT_ID=offline-protocol-java \ + bash "$UPLOADER" "$WORK/upload.zip" publish "$VERSION" >"$WORK/java-rerun.log" 2>&1 && + grep -q "offline-protocol-java/$VERSION/offline-protocol-java-$VERSION.pom" "$WORK/curl.log"; then + pass "the Java binding's re-run probe asks for its own POM" +else + fail "the Java binding's re-run probe did not ask for its own POM" + cat "$WORK/curl.log" >&2 +fi + if ! grep -rq 'secret' "$WORK"/*.log; then pass "the token is never printed" else