Skip to content

About

Swift package for the Offline Protocol SDK. Generated by the release workflow of Offline-Protocol/offline-protocol-sdk: do not edit.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Offline Protocol SDK for Swift

Offline-first messaging for iOS: BLE mesh and internet relay transports, with end-to-end encryption (MLS, RFC 9420) applied automatically.

This is the Swift package of the Offline Protocol SDK. It needs no React Native.

Install

In Xcode, add the package by URL and pick a version. In a manifest:

dependencies: [
    .package(url: "https://github.com/Offline-Protocol/offline-protocol-swift.git", from: "0.34.0")
],
targets: [
    .target(name: "YourApp", dependencies: [
        .product(name: "OfflineProtocolSDK", package: "offline-protocol-swift")
    ])
]

Requirements: iOS 13.0 or later. iOS only: the binary has no macOS or Mac Catalyst slice.

Integrators should read the Native iOS distribution guide on the main repository at the same X.Y.Z as this package (see VERSION) before wiring transports and permissions.

What is in it

Part What it is
offline_protocolFFI The Rust library, as an XCFramework for device and simulator
Generated bindings OfflineProtocol, ProtocolConfig, MeshServices, DataStore and the rest of the API, generated from the Rust interface
Transports The BLE, internet relay, Wi-Fi Direct, Nostr and Reticulum managers, the same sources the React Native module compiles
Storage The Keychain store for MLS material and the file store for protocol state, opened per account by OfflineProtocolReferenceStorage
Integrator helpers OfflineProtocolReferenceStorage, StorageConformance, OfflineProtocolDevelopmentCleartextConfig, OfflineProtocolEncryptFailedDiagnostics

The Rust core is an I/O-free engine. It queues, routes and encrypts, and never opens a socket or touches a radio for the protocol. A transport manager does the I/O for one transport: it drains the engine's outbound queue, sends, and hands inbound bytes back.

Getting started

  1. import OfflineProtocolSDK
  2. Build ProtocolConfig (see configuration on the main repo)
  3. let engine = try OfflineProtocol(config: config)
  4. engine.setEventCallback(callback: …) before start()
  5. let adoption = try OfflineProtocolReferenceStorage.initializeMls(on: engine, appId: config.appId, profile: config.profile) opens the built-in stores. Report adoption.warning when it is set: it is the only signal that this account started from a fresh MLS identity, with an empty outbox and an empty block list.
  6. try engine.start(), then wire transports (see the integration guide on the main repo)

Upgrading an app that already initializes MLS with its own storage providers or initializeMlsWithFileStores (every app on 0.33.0 and earlier)? Keep them. The reference storage holds nothing for those accounts, so switching starts a fresh identity, and adoption.warning does not report it (see UPGRADING §12.3).

A custom protocol-state backend is verified once, before you wire it in: run StorageConformance.run(on:) against a scratch instance, off the main thread (the suite blocks on writes of several megabytes). Green is what makes a backend supported (see the distribution guide). Lab-only cleartext and OfflineProtocolDevelopmentCleartextConfig are in native development cleartext.

Transports, plist entries, and background modes are still application wiring; the package ships the managers, not a drop-in mesh UI.

Where this package comes from

This repository is generated. Every source in it is a copy of a file in offline-protocol-sdk, written here by that repository's release workflow, and the VERSION file names the commit. Changes made here are overwritten by the next release. Issues and pull requests belong in the main repository.

License

AGPL-3.0-only, with a commercial license available. See LICENSE and LICENSE-COMMERCIAL.md. Cryptography export notice: EXPORT.md.

About

Swift package for the Offline Protocol SDK. Generated by the release workflow of Offline-Protocol/offline-protocol-sdk: do not edit.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages